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

SVG attributes set with no namespace #5734

Closed
syavorsky opened this issue Dec 25, 2015 · 5 comments
Closed

SVG attributes set with no namespace #5734

syavorsky opened this issue Dec 25, 2015 · 5 comments
Labels

Comments

@syavorsky
Copy link

Say we have a view rendering <use xlinkHref="#id"/> in a loop. First render displays all instances just fine, but newly appended use's would not show. Also calling getAttributeNS('http://www.w3.org/1999/xlink', 'href') on them would return null while returning #id for initial nodes.

Here is JSBin example with reproducible issue

@gaearon gaearon added the SVG label Dec 25, 2015
@gaearon
Copy link
Collaborator

gaearon commented Dec 25, 2015

I think this is the problem:

screen shot 2015-12-25 at 15 21 38

createNodesFromMarkup uses a dummy <div> so it can later assign innerHTML and pull out the created node.

However it seems like (some?) namespaced properties are only taken into account when SVG elements are created inside <svg>.

cc @spicyj

@gaearon
Copy link
Collaborator

gaearon commented Dec 25, 2015

Presumably, the reason it works initially is because it is inside svg when the markup is first assembled an rendered.

@gaearon
Copy link
Collaborator

gaearon commented Dec 25, 2015

Related: #5061 (comment)

@sophiebits
Copy link
Collaborator

This should work okay on master now since we use document.createElement(NS) for everything except server rendering.

@syavorsky
Copy link
Author

"This should work okay on master..." – awesome, thanks!

My temporary workaround was to wrap those elements into <g key={arrayFingerprint(colors)} />, hopefully that may help somebody

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

No branches or pull requests

3 participants