This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 27456 - Redefine Node.isDefaultNamespace(), Node.lookupNamespaceURI() and Node.lookupPrefix()
Summary: Redefine Node.isDefaultNamespace(), Node.lookupNamespaceURI() and Node.lookup...
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: DOM (show other bugs)
Version: unspecified
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Anne
QA Contact: public-webapps-bugzilla
Depends on:
Reported: 2014-11-27 19:02 UTC by Arkadiusz Michalski (Spirit)
Modified: 2016-04-18 17:47 UTC (History)
4 users (show)

See Also:


Description Arkadiusz Michalski (Spirit) 2014-11-27 19:02:11 UTC
Current definitions of this methods:

don't cover any implementations. I'm mention about this situation in bug:

Question is:
- what they should doing to be useful for devs
- what is their actual usage; can be modify without breaking something (or even remove if usage is close to 0). This method has been introduced by DOM Level 3.

It does not look good when the description in actual DOM does not match at least one implementation.
Comment 1 Philip J├Ągenstedt 2015-08-03 12:33:12 UTC
Can you summarize what you think the spec should say and, if you have time to figure it out, how that would differ from what is implemented in Blink today? There are no use counters for these methods, but I could add some if there's any non-trivial change suggested.
Comment 2 Arkadiusz Michalski (Spirit) 2015-08-04 22:53:23 UTC
Aditional bugs from Mozilla:

BTW, this example still was not correct, so Firefox behaviour is opposite to IE and Chrome behaviour even in such small things.

Old algorithms for this methods from DOM3:
New DOM is more simple and some other stuff which operate on namespace was kicked (like Document.normalizeDocument):

To be honest I have no idea what you can do with it. I never use this methods so try find some other usage cases but without satisfactory results. Most libraries for DOM don't use them, all other examples try operate on namespace:element by other way (iterate and directly checking element/attr properties, using CSS selector, etc.).

I try figure out how they are implemented in browesers, but realy, this was the worst in all DOM. I get different result in all browsers for HTML, when testing *XML (via DOMImplementation) get another differences, even for innerHTML:) I guess that because we have these differences no one uses these methods.

Maybe Jonas Sicking or Henri Sivonen (via could suggest some practical applications for them if they must stay in new DOM spec. Are there any data on their usage?

And of course remember that this methods came from Node, so again may be a potential problem for Attr, because they jump to owner Element (if exist), and who knows if devs don't use them directly in attributes. Currently all browsers still have them for Attr.
Comment 3 Philip J├Ągenstedt 2015-08-05 10:56:14 UTC
There aren't any use counters for these in Blink, but I had a look in the 20150101 httparchive dump, and the regex 'lookupPrefix|lookupNamespaceURI|isDefaultNamespace' only matches in 453 of 10139623 resources, which is ~0.0045~. Still, given how old these APIs are, I don't think that's low enough to just remove them, but it does mean we don't need to worry a lot about edge cases.
Comment 4 Aryeh Gregor 2016-04-14 13:16:27 UTC
Testing <> in Firefox, Chrome, and IE 11 shows that all fail a number of tests, but there's no single test that all three fail.  This suggests that the current spec is probably good enough to implement, given the marginal use of the feature.

(All three browsers pass all the lookupPrefix tests.  I didn't check to see how thorough the tests are or inspect Gecko source code to see whether we deviate significantly from the spec.)
Comment 5 Arkadiusz Michalski (Spirit) 2016-04-14 16:30:07 UTC
Aryeh Gregor check this:


	var newDiv = document.createElementNS("", "ns:div");
	var newTest = document.createElementNS("", "test");
	var newP = document.createElement("p");


	console.log(newDiv.namespaceURI + " | " + newDiv.prefix); // | ns
	console.log(newTest.namespaceURI  + " | " + newTest.prefix); // | null
	console.log(newP.namespaceURI  + " | " + newP.prefix); // | null

	console.log(newDiv.lookupPrefix("")); // ns
	console.log(newTest.lookupPrefix("")); // ns
	console.log(newP.lookupPrefix("")); // ns


Chrome: ns, ns, ns << per DOM this looks correct
Firefox: null, null, null
IE and Presto: ns, null, ns

"This suggests that the current spec is probably good enough to implement, given the marginal use of the feature." << yep, if finally some engine implements all of these guidelines, then changes in the spec will not necessarily.
Comment 6 Aryeh Gregor 2016-04-18 17:47:20 UTC
The spec seems fine, although browsers are not yet interoperable.  Reopen if there's a specific change you'd like in the spec (or, better, file a GitHub issue).