[selectors-api] NAMESPACE_ERR or SYNTAX_ERR when both applied

The spec (either Level 1 or Level 2) is unclear about which error should
be raised in a situation when both NAMESAPCE_ERR and SYNTAX_ERR apply,
and this is not the same in all browsers. That is, for a selector like

  a|b +

or

  a|b, +

IE9, Firefox 13 and Opera12alpha raise NAMESAPCE_ERR, while Chrome19
raises SYNTAX_ERR.


Two proposed solutions (sorted by my preference):

1. Explicitly undefine this case.

I don't think having interoperability on this is of big importance, but
in general having an explicit "undefined" is usually better than an
implicit one.

Proposed text:

change

  # If the group of selectors include namespace prefixes that need to
  # be resolved, the implementation must raise a NAMESPACE_ERR
  # exception.

to

  | If the group of selectors include namespace prefixes that need to
  | be resolved and match either dom_selectors_group or
  | dom_relative_selectors_group, the implementation must raise a
  | NAMESPACE_ERR exception. If the group of selectors include
  | namespace prefixes that need to be resolved and /doesn't/ match
  | either dom_selectors_group or dom_relative_selectors_group, the
  | implementation must raise either a NAMESPACE_ERR exception or a
  | SYNTAX_ERR exception. The exact choice is undefined.

2. Spec IE9, Firefox13 and Opera12alpha's behavior

Roughly speaking, the choice is "an invalid token or '|' whichever comes
first", but I'd note that in the corner case

  a|

Firefox13 and Oper12alpha raise NAMESPACE_ERR but IE9 raises SYNTAX_ERR.


Cheers,
Kenny

Received on Sunday, 17 June 2012 11:10:37 UTC