-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SVG elements with children #41
Comments
I've started running this through the debugger and there is definitely a problem in the I've been able to reduce the minimum markup to make this fail: const input = `<svg>
<use></use>
</svg>` I'm still investigating but it seems to have something to do with using a tag that can be self closing but has a closing tag provided. |
further reduced the minimum case; this fails too: const input = `<svg><use></use> </svg>` I think this is not a problem with |
@SkaterDad I've found the exact bug! When we iterate over tokens and an encounter a tag that is in a list of ones we know can be self closing ( Then later, if we encounter that unexpected closing tag ( input string:
expected tree structure:
actual tree structure:
That's why these html strings are throwing the I think I can develop a fix for this, where we explicitly check to see if a self-closing tag does indeed close itself, rather than assume that based on the name of the tag. Whatever strategy we pursue to fix this would require a major version bump because it would definitely change the behavior of the parser. @goto-bus-stop what are your thoughts on this? Is this something you'd be keen to accept a PR for? |
@goto-bus-stop got a fix for this! I'd love some feedback. |
I'd really like to get this fix merged, if this is something we're open to. hyperx underpins some really high value frameworks, so I'm keen to see some of these foundational problems get resolved. I'm also happy to help with a bit of maintainership if that would be useful. |
handle optional closing tags for self-closing tags. fixes #41
Issue
hyperx
is not allowing many SVG elements to have animation-related tags embedded in them.Both of these examples reproduce the issue:
In the 1st example, Hyperx is treating the and tags as sibling elements.
In the 2nd example, Hyperx is treating the 2nd and tags as siblings.
It seems to be a fairly common technique for animating SVGs, based on Codepen examples and articles like this: https://css-tricks.com/guide-svg-animations-smil/
Is this something that could be allowed?
The text was updated successfully, but these errors were encountered: