Skip to content

SVG issues with className #233

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

Closed
PaulBGD opened this issue Dec 31, 2016 · 1 comment · Fixed by #241
Closed

SVG issues with className #233

PaulBGD opened this issue Dec 31, 2016 · 1 comment · Fixed by #241
Labels

Comments

@PaulBGD
Copy link
Member

PaulBGD commented Dec 31, 2016

Basically you can't just svgElement.className because SVGs are unique in that they have 2 class names. The best solution for this is to do svgElement.setAttribute('class', value)

You can see this in action by doing:

var svg = document.createElementNS( 'http://www.w3.org/2000/svg', 'svg' )
svg.className = 'my-class-name';
svg.className // doesn't return our set className, instead the special svg object
@Rich-Harris
Copy link
Member

Fixed in 1.6.3

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

Successfully merging a pull request may close this issue.

2 participants