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
classMap directive does not work with SVG #930
Comments
Would you like to fix this? Should be as simple as changing that to a |
I would be glad to. I will have a pull request up later today or early tomorrow. |
@jridgewell Fixed in #932. |
Reopening because we had to revert #932 |
Any prospect of other approaches to get this to work? For those like me who came here because classMap doesn't work on SVGs, my workaround is to have a function that concatenates a class string without using the classMap directive and assign direct to the class attribute.
Not sure if this works across browsers, I don't have IE / Edge installed at the moment, will try it there once pushed to test server. |
Description
When using the
classMap
directive in an SVG template, I get the following error:The error comes from this line in
class-map.ts
.According to the SVG specification,
className
is a readonly property. This differs fromclassName
onElement
, which can be set.Steps to Reproduce
Live Reproduction Link
https://stackblitz.com/edit/lit-html-svg-classname-bug-repro
Expected Results
The class
active
should have been applied to<circle>
.Actual Results
The following error is thrown:
Browsers Affected
Should affect all browsers, but I only tested the ones checked below.
The text was updated successfully, but these errors were encountered: