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

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 
NOT_SUPPORTED_ERR exception.

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
   prefixes.

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.

http://dev.w3.org/2006/webapi/selectors-api/

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

-- 
Lachlan Hunt - Opera Software
http://lachy.id.au/
http://www.opera.com/

Received on Wednesday, 9 July 2008 10:20:53 UTC