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

Incorrect `namespaceURI`. #5585

Closed
neojski opened this issue Apr 7, 2015 · 5 comments
Closed

Incorrect `namespaceURI`. #5585

neojski opened this issue Apr 7, 2015 · 5 comments

Comments

@neojski
Copy link
Contributor

@neojski neojski commented Apr 7, 2015

Trying to fix the simple #1745 issue I've found that the following

<html xmlns="http://www.w3.org/1999/xhtml">
  <body>
    <svg id="svg" xmlns="http://www.w3.org/2000/svg"></svg>
    <script>
console.log(document.getElementById('svg').namespaceURI)
    </script>
  </body>
</html>

returns http://www.w3.org/1999/xhtml. Firefox, chrome and tests/wpt/web-platform-tests/html/dom/documents/dom-tree-accessors/document.getElementsByName/document.getElementsByName-namespace.xhtml show/want http://www.w3.org/2000/svg.

@jdm
Copy link
Member

@jdm jdm commented Apr 7, 2015

Right now the namespace for each element in provided in the constructor and is immutable. @kmcallister is this something that h5e should be providing, or should the DOM be watching for setting the xmlns attribute and updating the associated namespace?

@Ms2ger
Copy link
Contributor

@Ms2ger Ms2ger commented Apr 8, 2015

servo/html5ever#120 should fix this.

@neojski
Copy link
Contributor Author

@neojski neojski commented Apr 8, 2015

By the way, how does changing namespace work? I mean, one can modify xmlns attribute of a node and this information is propagated to the whole subtree. Which operation is slow: setting xmlns or getting xmlns? I can imagine either setting xmlns traverses the whole subtree or getting namespace traverses the tree up to the first parent that has its namespace set (via xmlns or prefix).

@neojski
Copy link
Contributor Author

@neojski neojski commented Apr 8, 2015

Oh, apparently namespace is not modifiable. See: https://developer.mozilla.org/en-US/docs/Web/API/Node/namespaceURI:

This is not a computed value that is the result of a namespace lookup based on an examination of the namespace declarations in scope. The namespace URI of a node is frozen at the node creation time.

@eefriedman
Copy link
Contributor

@eefriedman eefriedman commented Oct 27, 2015

This appears to work correctly on master. Am I missing anything?

@Ms2ger Ms2ger closed this Oct 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.