Skip to content
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

.className can't be used to set classes on SVG elements #1224

Closed
Conduitry opened this issue Mar 10, 2018 · 1 comment · Fixed by #1226
Closed

.className can't be used to set classes on SVG elements #1224

Conduitry opened this issue Mar 10, 2018 · 1 comment · Fixed by #1226

Comments

@Conduitry
Copy link
Member

Via sveltejs/v2.svelte.dev#216

As of Svelte 1.57.0 we are using classes to scope styles instead of attributes, and SVG DOM elements do not implement a className setter, so trying to set that throws an exception. Classes are allowed on SVG elements, but they can't be programmatically set that way.

I see that when classes are used on SVG elements normally, the generated code uses setAttribute, and so we should probably make sure we use that for CSS scope classes as well.

I'm not sure why this didn't show up in unit tests. Either there aren't any unit tests have scoped CSS and SVG or (more worrisome) jsdom erroneously supports .className setting on SVG elements.

@Rich-Harris
Copy link
Member

JSDOM does the right thing; we just didn't have adequate tests. Fixed in #1226

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants