On Thu, Nov 24, 2011 at 3:19 PM, Sean Hogan <[email protected]> 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
