W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2008

Re: Behavior of querySelector/querySelectorAll with |div and *|div

From: Lachlan Hunt <lachlan.hunt@lachy.id.au>
Date: Wed, 09 Jul 2008 12:20:13 +0200
Message-ID: <487490DD.1060209@lachy.id.au>
To: Sam Weinig <weinig@apple.com>
Cc: Webapps <public-webapps@w3.org>

Sam Weinig wrote:
> I don't think it is clear in the Selectors API spec what the behavior 
> should be when calling querySelector or querySelectorAll with a selector 
> string that contains selectors like "|div" or "*|div" in the case of an 
> implementation that does not support the NSResolver part.  I think it 
> would be reasonable if the "*|div" acted just like "div", but I am 
> unsure about the "|div" case.

When the implementation doesn't support the NSResolver and given those 
selectors, these are the cases that need to be dealt with:

1. querySelector("*|div", nsresolver);
2. querySelector("|div", nsresolver);
3. querySelector("*|div", null);
4. querySelector("|div", null);

The specification already defines:

| If the implementation does not support resolving namespaces, then when
| the nsesolver parameter is provided and it is not set to either null
| or undefined, the implementation must raise a NOT_SUPPORTED_ERR
| exception.

Therefore, in cases #1 and #2, the implementation must raise a 

In the latter two cases, there are no prefixes that need to be resolved 
using an NSResolver, and so the implementation may proceed.  I have 
clarified the spec to say.

* Authors may use *|foo or |foo without providing an NSResolver
* Defined that namespace prefixes only need to be resolved when
   the namespace component is neither * or empty.
* Defined that implementations must support * or empty namespace
   components, regardless of whether or not they support resolving

This behaviour appears to be compatible with both Opera and WebKit 
nightlies.  However, IE8 currently throws an exception for both |div and 
*|div, which will need to be fixed.

You may review these changes in the current editors draft.


Please let me know whether or not you are satisified with this response.

Lachlan Hunt - Opera Software
Received on Wednesday, 9 July 2008 10:20:53 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:26:11 UTC