W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2012

[selectors-api] NAMESPACE_ERR or SYNTAX_ERR when both applied

From: Kang-Hao (Kenny) Lu <kennyluck@csail.mit.edu>
Date: Sun, 17 Jun 2012 19:10:11 +0800
Message-ID: <4FDDBB13.80300@csail.mit.edu>
To: WebApps Working Group <public-webapps@w3.org>
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 GMT

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