Closed aloisklink closed 10 months ago
@aloisklink the newest master has a workaround that does not write data to the dom if it is the default anyway. Try it out if you like. Next step is to deprecate svgjs:data alltogether and use a data attribute instead
Bug report
Modifying an existing SVG sometimes adds
svgjs:data
attributes without declaring thesvgjs
XML namespace by usingxmlns:svgjs="http://svgjs.dev/svgjs"
. This causes an XML parsing error.Fiddle
https://jsfiddle.net/1x8fjk9e/3/
Both the input and output SVG look fine when rendered together on the same page (ignore the CSS issues, I'm not really sure why those are happening):
However, if you click the click here to view the broken output SVG link, you get the following error:
Explanation
svg.js
usingsvg.svg()
work when saved to a.svg
filesvg.attr("xmlns:svgjs", require("@svgdotjs/svg.js").namespaces.svgjs);
and now the generated SVGs seem to work fine!This bug was originally discovered when trying to modify the
width=100%
to the actual pixel value using svgdom in Node.JS.Node.JS reproduction
Input.svg
Test script
Output.svg
diff input.svg output.svg
(I've run
prettier
on both the SVGs first to make the diff more beautiful)