w3c / spec-prod

GitHub Action to build ReSpec/Bikeshed specs, validate output and publish to GitHub pages or W3C
https://w3c.github.io/spec-prod/
MIT License
34 stars 21 forks source link

Copying linked files fails with embedded SVG <a> elements #139

Closed rakuco closed 2 years ago

rakuco commented 2 years ago

132 seems to have introduced a bug that can be reproduced when running build.js on https://github.com/w3c/sensors/2b77580c9d7fb2ecb68c5ef264d2ce5c69f5c901/main/index.bs.

The output is not very helpful and looks like this:

    [INFO] Finding relevant assets…
      [INFO] From /index.bs.built.html…
      Invalid URL

Running things manually and adding some debugging, the problem is in https://github.com/sidvishnoi/subresources/commit/f7061dfed9b643a9468a1d038b5f2a8b042bbe7d: getLinks() uses "a[href]" as a selector, which ends up including <a> elements inside <svg> documents. These <a> elements are SVGAElements though, and their href attribute returns an object instead of a string, and it breaks findAssetsToCopy in this repository.

I'm filing this issue because I'm not sure if the idea was to ignore links in embedded SVG or if they need to be properly parsed instead (the links in the Generic Sensor spec refer to anchors in the actual spec and thus outside the SVG document, for example).

rakuco commented 2 years ago

cc @sidvishnoi

sidvishnoi commented 2 years ago

Thank you for finding the cause. I'll find some time in day tomorrow to fix it and improve the logging.