Re: [SelectorsAPI] Selector detection needed?

* Nicholas C. Zakas wrote:
>I don't see this mentioned in the spec anywhere. The only error that
>seems to be mentioned is when an unresolvable namespace is encountered
>in a selector.

In http://www.w3.org/TR/2007/WD-selectors-api-20071221/ immediately
before the requirement you cite, "If the given group of selectors
(selectors) is invalid, the user agent must raise a SYNTAX_ERR
exception ([DOM3Core], section 1.4)".

>Regardless, do you think that throwing an error when an unknown selector
>is encountered is really the most appropriate way to go? I'd rather see
>this API go the way of capability detection rather than exception
>throwing. I think the former is easier to implement and more likely to
>be implemented than the latter.

There are several issues here, one is that implementations typically
cannot tell selectors depending on unimplemented features and selectors
with actual syntax errors apart. Clearly the latter kind should trigger
some form of error response, typically an exception. Further, to avoid
the many constants in your proposal, and to also consider other possible
constraints (e.g., an implementation might support one id per selector
but not multiple selectors) and to support selectors from dynamic
sources, the testing function would take a whole selector, so ultimately
there would be little difference between the two approaches. You could
in fact implement your test function by checking for the exception.

Please note by the way that the feedback list for the CSS Query API
draft is <public-webapi@w3.org>.
-- 
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 Monday, 7 April 2008 02:16:08 UTC