The CSS grammar (http://www.w3.org/TR/selectors/#w3cselgrammar) has a
production for selector_group and selector. I would think that :scope would
be prepended to each selector, not the entire selector group.
-- Yehuda Katz
On Tuesday, October 25, 2011, Tab Atkins Jr. wrote:
> On Tue, Oct 25, 2011 at 2:33 PM, Sean Hogan <shogun70@westnet.com.au<javascript:;>>
> wrote:
> > On 26/10/11 7:51 AM, Tab Atkins Jr. wrote:
> >> On Tue, Oct 25, 2011 at 1:47 PM, Sean Hogan<shogun70@westnet.com.au<javascript:;>
> >
> >> wrote:
> >>>
> >>> I think allowing explicit :scope in findAll() will be perpetually
> >>> confusing.
> >>> I can imagine someone looking at old code like:
> >>>
> >>> e.findAll("div.foo span, div.bar :scope span")
> >>>
> >>> and asking themselves "what's the rule again? If there's :scope in the
> >>> selector then there's no :scope implied? Or was that just on each
> single
> >>> selector? Or is :scope always implied at the start of the whole
> selector
> >>> list and that's why it's explicit in the second part? Dammit, why
> didn't
> >>> we
> >>> just use querySelectorAll() if we wanted explicit :scope?"
> >>
> >> Using :scope explicitly at the beginning of selectors is necessary if
> >> we want a sane way to have selector lists chain off of the scoping
> >> element. I'm okay with the string starting with a combinator when
> >> it's a single selector like "+ foo", but not when it's a selector list
> >> like "+ foo, + bar".
> >
> > I didn't follow that. Why does findAll() need to support explicit :scope?
>
> Did you not understand my example? el.find("+ foo, + bar") feels
> really weird and I don't like it. I'm okay with a single selector
> starting with a combinator, like el.find("+ foo"), but not a selector
> list.
>
> ~TJ
>
--
Yehuda Katz
(ph) 718.877.1325