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

On Wed, Oct 26, 2011 at 1:47 PM, Jonas Sicking <jonas@sicking.cc> wrote:
> On Tue, Oct 25, 2011 at 10:43 AM, Yehuda Katz <wycats@gmail.com> wrote:
>> e.findAll("div, :scope") // 0,context,1,2,3,4,5,6
>
> Huh, why 0 and 6? What's the logic there? I would have expected it to
> be a sorted union of the results returned from the individual parts.
> I.e. something like:
>
> sortedUnion(e.findAll("div"), e.findAll(":scope"))
>
> Which would yield [context, 1, 2, 3, 4]

Agreed.  Any behavior switch based on the contents of a complex
selector should be limited to that complex selector, rather than
polluting the entire selector list.


>> e.findAll(":not(:scope)") // all elements except context
>
> What do you mean by "all elements"? All elements in the whole document
> (except the context node). Including the <body> and any siblings it
> might have (and their descendants)?

Yes to both.  It would be identical to giving the context element a
unique id, and then just doing a normal full-document query for
":not(#unique)".

~TJ

Received on Wednesday, 26 October 2011 20:52:28 UTC