tmedwards / sugarcube-2

SugarCube is a free (gratis and libre) story format for Twine/Twee.
https://www.motoslave.net/sugarcube/2/
BSD 2-Clause "Simplified" License
177 stars 41 forks source link

First `</svg>` tag closes entire nest #98

Closed cyrusfirheir closed 3 years ago

cyrusfirheir commented 3 years ago

Didn't know how to make the title clearer.

Test case:

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
    <rect x="0" y="0" width="100" height="100" fill="salmon" />
    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" x="25" y="25" width="50" height="50">
        <rect x="0" y="0" width="100" height="100" fill="cornflowerblue" />
    </svg>
    <rect x="10" y="10" width="50" height="50" fill="pink" />
</svg>

Closes both the SVGs at the first </svg> tag, the <rect> after doesn't make sense even though it is in the DOM, and there's a stray </svg> left behind as a plain string...