-
-
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
Style props are incompatible with SVG components #7808
Comments
Interesting enough the RFC discussion doesn't have any "svg" in it sveltejs/rfcs#13 but the final RFC does indeed say this
So the second half about SVG is neither documented nor implemented. |
Thanks for the fix @tanhauhau and @baseballyama! |
This should be fixed now in 3.51.0 - https://svelte.dev/repl/b7a3f94255914044b35462234ccaea43?version=3.51.0 |
Describe the bug
Summary:
Passing style props to any component wraps the element in a
<div>
, which breaks the SVG spec for anything rendered inside an<svg>
.Details:
If I want to create a Svelte component that renders an SVG element with custom style props:
When passing the style props to the component:
Svelte wraps the element in a
<div>
, which breaks the SVG rendering because SVG's cannot contain<div>
elements.Given that the options for passing styles to sub-components in Svelte are already limited, and the fact that Svelte is used extensively in data visualization, I would expect that passing style props should be possible for SVG elements.
Reproduction
https://svelte.dev/repl/b7a3f94255914044b35462234ccaea43?version=3.49.0
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: