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

Invalid setAttributeNS syntax #6

Closed
ramijarrar opened this issue Dec 26, 2015 · 9 comments
Closed

Invalid setAttributeNS syntax #6

ramijarrar opened this issue Dec 26, 2015 · 9 comments

Comments

@ramijarrar
Copy link

You need to specify the qualified name (i.e 'xlink:href' not 'href') when using setAttributeNS.

@ramijarrar
Copy link
Author

Note that getAttributeNS takes the local name so your current implementation for that is correct.

See the API for both here and here

@Keyamoon
Copy link
Owner

What was the point in opening this issue then?

@ramijarrar
Copy link
Author

See my first comment above, the issue is with the setAttributeNS syntax I was just pointing out that this issue does not also apply to getAttributeNS.

@ramijarrar
Copy link
Author

In other words this line of code uses the wrong syntax:

uses[i].setAttributeNS(xlinkNS, 'href', '#' + hash);

It needs to look like this:

uses[i].setAttributeNS(xlinkNS, 'xlink:href', '#' + hash);

@Keyamoon
Copy link
Owner

The prefix in the qualified name seems to be optional though: http://www.w3.org/TR/1999/REC-xml-names-19990114/#ns-qualnames

And when I tested the demo in IE 9 and 10, there was no issue. Have you encountered any issues with the current setAttibuteNS?

@ramijarrar
Copy link
Author

It is reported here that this can cause issues in Chrome.

@Keyamoon
Copy link
Owner

Fair enough. I will add the prefix in a moment.

Keyamoon added a commit that referenced this issue Dec 27, 2015
@ramijarrar
Copy link
Author

Btw - since the polyfill only activates in IE leaving it probably won't do any harm, but I guess it's better to err on the side of caution.

@Keyamoon
Copy link
Owner

I agree. It can't hurt. I just tested it in IE again to make sure the addition of the prefix won't cause issues.

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

2 participants