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

When an SVG element is in the DOM it produces an error #121

Open
widmoser opened this issue Feb 28, 2014 · 3 comments
Open

When an SVG element is in the DOM it produces an error #121

widmoser opened this issue Feb 28, 2014 · 3 comments

Comments

@widmoser
Copy link

The error message is:

Uncaught TypeError: Object #<SVGAnimatedString> has no method split

An easy fix would be the following: Change this line to

    if (child.nodeType === exports.ELEMENT_NODE && !(child.className instanceof SVGAnimatedString)) {

Maybe you have a more generic idea on how to solve it.

@mikedidthis
Copy link

The issue seems to be when the element being rendered contains a svg element.

Sadly the fix @widmoser posted didn't work for me, but helped me with my own. I believe the issue is down to the svg elements not supporting className.

At line 32 of elementFactory.js, replace it with:

    this.classNames = '';
    if ( ! el instanceof SVGElement ) {
      this.classNames = this.el.className.split(' ');
    } 

Hacky, but works as far as I can tell.

@dospromptman
Copy link

I have this issue, also. Additionally, I need content injected into the svg element in my markup.

I replaced the this.classNames = this.el.className.split(' ') assignment with this.classNames = (this.el.hasAttribute('class') ? this.el.getAttribute('class').split(' ') : [])

I haven't run any extensive tests, but it does seem to solve the issue in my case.

@LMLB
Copy link

LMLB commented Feb 15, 2018

Just ran into this issue, too.

I worked around it by injecting the svg element instead.

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

No branches or pull requests

4 participants