W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2011

Re: [Selectors API 2] Is matchesSelector stable enough to unprefix in implementations?

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Thu, 24 Nov 2011 19:04:10 -0800
Message-ID: <CAAWBYDByKfHoeZqf8j-dmF8ut6P=uricZtMwOfXhF7pSGCGErA@mail.gmail.com>
To: Sean Hogan <shogun70@westnet.com.au>
Cc: Yehuda Katz <wycats@gmail.com>, Boris Zbarsky <bzbarsky@mit.edu>, Lachlan Hunt <lachlan.hunt@lachy.id.au>, public-webapps@w3.org
On Thu, Nov 24, 2011 at 3:19 PM, Sean Hogan <shogun70@westnet.com.au> wrote:
> This has been raised before, but I'll restate it here.
>
> How should the selector be expanded in
>     elt.findAll("div span, div :scope span")?
>
> The straight-forward interpretation of "implies :scope unless it is
> explicit" is to not expand this, thus:
>     "div span, div :scope span"
>
> But with that interpretation
>     elt.findAll("> div span, div :scope span")
> will throw an error, although
>     elt.findAll("> div span"); elt.findAll("div :scope span");
> is allowed.
>
> If this isn't to throw an error then a more complex definition is required
> which can apply a different rule for implying :scope in different parts of
> the selector argument. This is sure to be confusing for anyone reading the
> code.

You don't need a complex definition.  The rule applies per selector
(to be precise, per "complex selector", using current terminology.
Your example shows a comma-separated *list* of selectors.  Thus,
:scope is prepended to the first selector, and not to the second
selector.

However, this is irrelevant for matches().  It doesn't need to, and
shouldn't, imply :scope.

~TJ
Received on Friday, 25 November 2011 03:05:04 GMT

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