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: Thu, 10 Jul 2008 14:31:36 -0700
Message-ID: <48767FB8.1080803@terrainformatica.com>
To: Lachlan Hunt <lachlan.hunt@lachy.id.au>
CC: www-style <www-style@w3.org>

Lachlan Hunt wrote:
>
> Hi,
>   This is a proposal for a new :context pseudo-class designed to match 
> the context node of a query, where the the scope of elements that 
> match a given Selector is constrained to be within a subtree rooted by 
> a particular node.
>
> This proposal has been developed based on work within the Web 
> Application Working Group.  It has been designed primarily for use 
> with Selectors API to meet the needs of JavaScript libraries such as 
> JQuery and Dojo, but is also suitable for use with scoped stylesheets 
> in HTML5.
>
> I am prepared to be the editor of this specification and, if 
> necessary, join the CSS WG in order to do so, or it could be worked on 
> within the WebApps WG under advise from the CSS WG.
>
> The proposal can be found here:
>
> http://lists.w3.org/Archives/Public/www-archive/2008Jul/att-0019/Overview.html 
>
>
Lachlan, why not to use existing :root pseudo-class for that?

Like:

el = container.selectChild(":root > div");

Standard CSS does lookups from the root element so :root is the root 
node of the document tree
and if you are querying subtree of some element then this element is the 
root for the lookup purposes.

That is if you querying in depth of subtree. When you query parent chain 
for the parent then :root is the document
root node:

el = container.selectParent(":root > body > div");

will find parent of the element that is root/body/div.

In any case :root is a better name for this thing, no?

--
Andrew Fedoniouk.

http://terrainformatica.com
Received on Thursday, 10 July 2008 21:32:50 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:55:10 GMT