W3C home > Mailing lists > Public > www-style@w3.org > July 2008

Re: Opera's Proposal for :context Selector

From: Andrew Fedoniouk <news@terrainformatica.com>
Date: Sun, 13 Jul 2008 17:37:36 -0700
Message-ID: <487A9FD0.7060305@terrainformatica.com>
To: Lachlan Hunt <lachlan.hunt@lachy.id.au>
CC: www-style <www-style@w3.org>

Lachlan Hunt wrote:
> Andrew Fedoniouk wrote:
>> Am I correct in my understanding that:
>>   localRoot.querySelector("div")
>> will mean precisely:
>>   localRoot.querySelector(":context div")
> In that particular case, yes, because the results are restricted to 
> elements contained within the context node.  But not in this case:
> foo.querySelector("div div");
> That is not the same as either
> foo.querySelector(":context div div")
> And similarly when using other combinators.  This is all clearly 
> explained in that email I linked to before.

Could you add to your cases also this:

scoped style set
    p:root > button { background-color:yellow; }
    li:root > button { background-color:green; }


That is practical case we use in scoped style sheets.
This allows to apply the same set to different elements - so to reuse it.

I mean that for the method like


that implied :scope on the left would probably work but
for scoped selectors (that presumably shall use the same implementation)
having something like [type="calendar"]:root is highly desired.

We ended up with Solution #1 combined with Solution #3 that is:

In scoped selector :root is evaluated to the root element of the scope
and lookup happens on the set including element itself and all its 

So we have[1] in fact following:

1) element.select([callback,] selector)
    - :root is the element.
2) element.selectParent([callback,] selector)
    - :root is the global root.
3) element.match(selector)
    - :root is the global root.

This covers all methods found in jQuery.

My 3 cents.

Andrew Fedoniouk.


[1] the Sciter, microDOM implementation:
Received on Monday, 14 July 2008 00:38:18 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:38 UTC