weisJ/jsvg

Mask on element/group with empty bound throws exception

Closed this issue · 0 comments

Bad SVG:

<svg width="13" height="13" viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg">
    <rect x="2.47559" y="2.60547" width="12" height="12" rx="6" stroke="#878E98"/>
    <mask id="mask0_598_822" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="1" y="2" width="14" height="14">
        <rect x="2.47559" y="2.60547" width="12" height="12" rx="6" fill="white" stroke="white"/>
    </mask>
    <g mask="url(#mask0_598_822)">
    </g>
</svg>

Workaround: https://jakearchibald.github.io/svgomg/ can optimize SVG to make it renderable, but it will be great if JSVG can render such SVGs (as chrome/batik does).

Expected:
Screenshot 2023-06-23 at 11 56 57