-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 in <slot> not rendered as SVG elements #3321
Comments
I am experiencing similar behavior. I think it may simply be a case of including all the other svg elements in this check here. At least, quickly changing it seemed to work for me. |
I try to repro: https://svelte.dev/repl/ace7458e21a448809b2cf0a0048b4b7f?version=3.8.0 It's look like problem was gone for now ( svelte 3.8.0 ) |
@shaltaev will test later today. |
The problem still occurs for me, seems to happen when the https://svelte.dev/repl/d0566c01757442fbbfdbe7fc73247081?version=3.8.0 |
@davebrent problem remains, with 3.8.0 my string literal solution stopped working :-) |
Fix namespace for svg elements inside slots
It resolves the issue on my side as well. Small note. This has now stopped working: <Icon>{@html '<rect x=0 y=0 width=20 height=20/>'}</Icon> But this works. <Icon><g>{@html '<rect x=0 y=0 width=20 height=20/>'}</g></Icon> It's relevant to my use case because I receive the icon markup as a string in an object. |
@Rich-Harris I am still experiencing this issue. @rikschennink 's workaround addresses it, but I'd love to understand better what the problem is with the other form. |
Describe the bug
I have a component that is basically an
<svg>
with a<slot>
the idea being that it's easy to pass some svg tags to the component and have them all rendered the same. This works fine as long as the SVG is passed as an HTML string.{@html '<rect x=0 y=0 width=20 height=20/>'}
but if it's passed as an element, it no longer works.This doesn't work:
This does work:
To Reproduce
Icon component
Expected behavior
SVG elements should be rendered as SVG.
Information about your Svelte project:
Severity
Annoying, results in less readable code. Also, I wonder if this impacts the binary size in any way.
I suspect this issue is related, but was closed.
#2557
The text was updated successfully, but these errors were encountered: