<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>27456</bug_id>
          
          <creation_ts>2014-11-27 19:02:11 +0000</creation_ts>
          <short_desc>Redefine Node.isDefaultNamespace(), Node.lookupNamespaceURI() and Node.lookupPrefix()</short_desc>
          <delta_ts>2016-04-18 17:47:20 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>DOM</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows NT</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WORKSFORME</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Arkadiusz Michalski (Spirit)">crimsteam</reporter>
          <assigned_to name="Anne">annevk</assigned_to>
          <cc>ayg</cc>
    
    <cc>mike</cc>
    
    <cc>philipj</cc>
    
    <cc>www-dom</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>115630</commentid>
    <comment_count>0</comment_count>
    <who name="Arkadiusz Michalski (Spirit)">crimsteam</who>
    <bug_when>2014-11-27 19:02:11 +0000</bug_when>
    <thetext>Current definitions of this methods:
http://dom.spec.whatwg.org/#dom-node-isdefaultnamespace
http://dom.spec.whatwg.org/#dom-node-lookupnamespaceuri
http://dom.spec.whatwg.org/#dom-node-lookupprefix

don&apos;t cover any implementations. I&apos;m mention about this situation in bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=1061578

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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>122400</commentid>
    <comment_count>1</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2015-08-03 12:33:12 +0000</bug_when>
    <thetext>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&apos;s any non-trivial change suggested.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>122460</commentid>
    <comment_count>2</comment_count>
    <who name="Arkadiusz Michalski (Spirit)">crimsteam</who>
    <bug_when>2015-08-04 22:53:23 +0000</bug_when>
    <thetext>Aditional bugs from Mozilla:
https://bugzilla.mozilla.org/show_bug.cgi?id=312019
https://bugzilla.mozilla.org/show_bug.cgi?id=505178

BTW, this example https://bugzilla.mozilla.org/show_bug.cgi?id=312019#c17 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:
http://www.w3.org/TR/DOM-Level-3-Core/namespaces-algorithms.html
New DOM is more simple and some other stuff which operate on namespace was kicked (like Document.normalizeDocument):
http://www.w3.org/TR/DOM-Level-3-Core/core.html#Document3-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&apos;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 https://bugzilla.mozilla.org/show_bug.cgi?id=505178#c10) 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&apos;t use them directly in attributes. Currently all browsers still have them for Attr.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>122464</commentid>
    <comment_count>3</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2015-08-05 10:56:14 +0000</bug_when>
    <thetext>There aren&apos;t any use counters for these in Blink, but I had a look in the 20150101 httparchive dump, and the regex &apos;lookupPrefix|lookupNamespaceURI|isDefaultNamespace&apos; only matches in 453 of 10139623 resources, which is ~0.0045~. Still, given how old these APIs are, I don&apos;t think that&apos;s low enough to just remove them, but it does mean we don&apos;t need to worry a lot about edge cases.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>125841</commentid>
    <comment_count>4</comment_count>
    <who name="Aryeh Gregor">ayg</who>
    <bug_when>2016-04-14 13:16:27 +0000</bug_when>
    <thetext>Testing &lt;http://w3c-test.org/dom/nodes/Node-lookupNamespaceURI.html&gt; in Firefox, Chrome, and IE 11 shows that all fail a number of tests, but there&apos;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&apos;t check to see how thorough the tests are or inspect Gecko source code to see whether we deviate significantly from the spec.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>125859</commentid>
    <comment_count>5</comment_count>
    <who name="Arkadiusz Michalski (Spirit)">crimsteam</who>
    <bug_when>2016-04-14 16:30:07 +0000</bug_when>
    <thetext>Aryeh Gregor check this:

&lt;script&gt;

	var newDiv = document.createElementNS(&quot;www.test.com&quot;, &quot;ns:div&quot;);
	var newTest = document.createElementNS(&quot;www.test.com&quot;, &quot;test&quot;);
	var newP = document.createElement(&quot;p&quot;);

	newDiv.appendChild(newTest);
	newDiv.appendChild(newP);


	console.log(newDiv.namespaceURI + &quot; | &quot; + newDiv.prefix); // www.test.pl | ns
	console.log(newTest.namespaceURI  + &quot; | &quot; + newTest.prefix); // www.test.pl | null
	console.log(newP.namespaceURI  + &quot; | &quot; + newP.prefix); // http://www.w3.org/1999/xhtml | null

	console.log(newDiv.lookupPrefix(&quot;www.test.com&quot;)); // ns
	console.log(newTest.lookupPrefix(&quot;www.test.com&quot;)); // ns
	console.log(newP.lookupPrefix(&quot;www.test.com&quot;)); // ns

&lt;/script&gt;

Chrome: ns, ns, ns &lt;&lt; per DOM this looks correct
Firefox: null, null, null
IE and Presto: ns, null, ns

&quot;This suggests that the current spec is probably good enough to implement, given the marginal use of the feature.&quot; &lt;&lt; yep, if finally some engine implements all of these guidelines, then changes in the spec will not necessarily.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>125888</commentid>
    <comment_count>6</comment_count>
    <who name="Aryeh Gregor">ayg</who>
    <bug_when>2016-04-18 17:47:20 +0000</bug_when>
    <thetext>The spec seems fine, although browsers are not yet interoperable.  Reopen if there&apos;s a specific change you&apos;d like in the spec (or, better, file a GitHub issue).</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>