Re: Opera's Proposal for :context Selector

Andrew Fedoniouk wrote:
> Lachlan Hunt wrote:
>> http://lists.w3.org/Archives/Public/www-archive/2008Jul/att-0019/Overview.html 
> 
> Lachlan, why not to use existing :root pseudo-class for that?

Because Selectors defines :root as:

| The :root pseudo-class represents an element that is the root of the
| document. In HTML 4, this is always the HTML element.

Therefore, reusing :root for this would require redefining it for a 
purpose it was not originally intended for.

> 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.

It may be the root of the subtree, but it is not the document's root 
element, which is what :root matches.

> 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.

I do not understand what you are trying to say.  What are the 
selectChild() and selectParent() methods you are demonstrating her? 
Where are they defined?  It might be easier if you provided example 
markup to go with the examples, but it would be even easier if you would 
stick with the APIs already being defined in Selectors API.

http://dev.w3.org/2006/webapi/selectors-api/

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

Received on Thursday, 10 July 2008 21:55:19 UTC