Re: QSA, the problem with ":scope", and naming

On 2011-10-20 16:23, Boris Zbarsky wrote:
> On 10/20/11 1:08 AM, Tab Atkins Jr. wrote:
>> I disagree. It's extremely useful and natural for .find(":scope +
>> div") to match sibling of the context node.
>
> I really don't think it is. If you want that, use document.find(":scope
> + div", context).
>
>> Basically, the presence of :scope would turn off *all* the limitations
>
> That's a _really_ bizarre behavior. So in this case:
>
> foo.find(":scope + div, div")
>
> what all divs in the document would be found? Or is the "oh, ignore the
> reference node except for matching :scope" meant to only apply on a
> per-selector basis inside the selector list? That has its own issues,
> especially with performance (e.g. merging nodesets while preserving DOM
> order).

As it was specified in the old draft of queryScopedSelector (which is 
the definition I start with if find/findAll get introduced), it was done 
on a per selector basis, so the above would be equivalent to:

document.querySelector(":scope + div, :scope div", foo);

-- 
Lachlan Hunt - Opera Software
http://lachy.id.au/
http://www.opera.com/

Received on Thursday, 20 October 2011 15:01:34 UTC