W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2009

Re: [selectors-api] Test Suite Missing tests for Namespace Selectors

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Thu, 12 Mar 2009 11:01:57 -0400
Message-ID: <49B923E5.4020101@mit.edu>
To: Alexey Proskuryakov <ap@webkit.org>
CC: Lachlan Hunt <lachlan.hunt@lachy.id.au>, public-webapps <public-webapps@w3.org>
Alexey Proskuryakov wrote:
> This is actually a difference in createElementNS(null, "p") vs. 
> createElementNS("", "p") behavior. I don't know whose bug it is, but in 
> Firefox and Opera, empty and null namespace arguments both result in 
> null namespace for the created element.

Interesting question.  DOM 2 Core has this to say (section 1.1.8, XML 
Namespaces):

   Note that because the DOM does no lexical checking, the empty
   string will be treated as a real namespace URI in DOM Level 2
   methods. Applications must use the value null as the namespaceURI
   parameter for methods if they wish to have no namespace.

But DOM 3 Core (which I would assume supercedes that) says (section 
1.3.3, XML Namespaces):

   In programming languages where empty strings can be differentiated
   from null, empty strings, when given as a namespace URI, are
   converted to null. This is true even though the DOM does no lexical
   checking of URIs.

At the same time, the DOM 3 Core definition of createElementNS says:

   Per [XML Namespaces], applications must use the value null as the
   namespaceURI parameter for methods if they wish to have no
   namespace.

Make of this what you will.  But as I recall, the change in the "XML 
Namespaces" section was meant precisely to ensure that in JS passing "" 
for all namespace URIs would work exactly like passing null.

Sounds like webkit either implements createElementNS per DOM Core 2 or 
has a buggy DOM Core 3 impl.

In either case, the test should probably pass null, not "".

-Boris
Received on Thursday, 12 March 2009 15:08:57 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:30 GMT