W3C home > Mailing lists > Public > public-webapi@w3.org > April 2008

CSS Query API vs Core lookupNamespaceURI

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Tue, 22 Apr 2008 17:58:11 +0200
To: public-webapi@w3.org
Message-ID: <h82s04tco4c02vj20i3ta6ld6jrpgh27or@hive.bjoern.hoehrmann.de>

Hi,

  If an attribute node stores a selector and the in-scope namespace
declarations are to be used to expand names in the selector, the most
natural way to set that up would simply be with

  example.querySelector(attr.value, attr.lookupNamespaceURI);

Or with a wrapper function if necessary to the same effect. However,
due to differences between the resolvers this might not work as ex-
pected, in particular, Core's lookupNamespaceURI expects a "null"
argument to find the default namespace, but the querySelector imple-
mentation would pass the empty string (presumably Core should accept
the empty string aswell), and if an XML 1.1 document uses

  <example selector='a|b' xmlns:a='' ...>

The expected result would be that only 'b' elements in no namespace
would be matched, but per "If there was no NSResolver object provided,
or if the method returns an empty string or does not return a DOMString,
the prefix represents an unresolvable namespace" the code would actually
match 'b' elements in any namespace and elements in no namespace.

This difference should either be removed or be explained in the
document. For the other issue, either querySelector passes null to get
the default namespace, or an issue against DOM Core should be filed.

regards,
-- 
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 
Received on Tuesday, 22 April 2008 15:58:45 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 22 April 2008 15:58:47 GMT