-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
div within svg is not treated equally by the compiler if the div is in a component #6385
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
Comments
It's really weird but when you add this attr to your div
It works: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/foreignObject |
Yes i know that and i have already written that in the issue and it's already part of the fleshed out example. The Point is, that the svelte compiler does different things even tough the compiler should do the same thing. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been closed as it was previously marked as stale and saw no subsequent activity. |
@Rich-Harris this is still an issue, please can we reopen? The above REPL clearly shows the issue. |
Describe the bug
Sorry for the confusing title, but i had no better idea. And it's much easier to see it in the REPL than describing it.
I have an svg element and try to add a Component with a foreignObject in it and a default slot. In the first case the div element is part of the slot and in the second case the div is part of the component.
In the first case the compiler creates an svg_element and in the second the compiler creates a normal element. (As seen in the JS Output Tab) I think the first case is the correct case, because there is no xmlns attribute on the div. I have tried to show that in the more fleshed out REPL. I don't know if this is worth to be fixed, but i stumbled over this bug and i wanted to show this.
To Reproduce
Minimal REPL
https://svelte.dev/repl/52d3b5cdb017498e82eb2d958fdc2782?version=3.38.2
More fleshed out REPL
https://svelte.dev/repl/0564bbb5485840d0909593059b77185f?version=3.38.2
Expected behavior
Same Output at least. In the minimal REPL the first part where nothing is shown is the correct part i think, because it has no xmlns attribute. But otherwise there is no div-svg element at all https://developer.mozilla.org/en-US/docs/Web/SVG/Element so maybe a compiler warning would be nice?
Severity
Just confusing behavior.
The text was updated successfully, but these errors were encountered: