Skip to content

Conversation

@gingerchris
Copy link

As noted on MDN, the value of el.className might not be as expected when el is an SVGElement. Instead of the expected string, it can be an instance of SVGAnimatedString.

When this is the case, tests fail with the following error:

TypeError: this.classNames(...).split is not a function

This PR instead returns the contents of the element's class attribute when the element tagName is svg

@ayrton
Copy link
Contributor

ayrton commented Nov 20, 2017

Can you add a test case please

@gingerchris
Copy link
Author

I am struggling to write a test case that fails prior to this addition, which is frustrating as this is causing tests to fail in my codebase.

This codepen example demonstrates the className returning an SVGAnimatedString but when I add an svg to the Fixture in the className test it returns the className value specified in the markup.

What's the best way to get help on this? Should I create an issue? Thanks

@gingerchris gingerchris deleted the SVGAnimatedString-className-fix branch September 28, 2022 06:34
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 this pull request may close these issues.

2 participants