felixfbecker / dom-to-svg

Library to convert a given HTML DOM node into an accessible SVG "screenshot".
MIT License
377 stars 41 forks source link

Custom namespaces declarations not preserved in generated SVG #174

Open PlkMarudny opened 2 years ago

PlkMarudny commented 2 years ago

In the captured SVG I can see:

<svg xmlns="http://www.w3.org/2000/svg"
    xmlns:xlink="http://www.w3.org/1999/xlink" 
    data-stacking-context="true" 
    aria-owns="chart-container1" 
    width="832" height="394" 
    viewBox="0 22 832 394">

While the source looks like:

<svg
    width="170"
    height="42.5"
    version="1.1"
    viewBox="0 0 303 42.5"
    xmlns="http://www.w3.org/2000/svg"
    x={width - 164}
    y={y - 19}
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xmlns:asharq="http://www.asharq.com/namespaces/asharq"
>

Attributes from the custom namespace do exist in the generated SVG, but lack of declaration breaks the SVG effectively.