- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Thu, 24 Nov 2011 19:04:10 -0800
- 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 UTC