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 15:58:39 -0700
Message-ID: <4876941F.6090506@terrainformatica.com>
To: Lachlan Hunt <lachlan.hunt@lachy.id.au>
CC: www-style <www-style@w3.org>

Lachlan Hunt wrote:
> 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.
You do not need to redefine it in the first place (in master CSS spec.)
It is just enough to put remark in your document - "for in depth subtree 
queries :root is the element itself" or something like that.
It does not contradict original meaning in HTML/CSS
>> 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.
document root is not accessible inside in-depth lookups.
Theoretically you can do something like:

container.querySelector(:document-root > something)

but it is almost not useful in discussed domain.

>> 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/
1) I cannot understand phrase "query selector" to be honest. Query it 
for what?
2) selectors-api appears as impractical for the following reasons:
    a) There is a need for parent lookups too,  like:
        element.selectParent("ul.foo") - returns nearest matching parent 
        element.selectLastParent("ul.foo") - returns farthermost 
matching parent element.
    b) querySelectorAll is quite ineffective in practice - it should be 
form with callback function. Otherwise it is not clear of what to do with
        the returned list in GC environments and functional languages 
like JS.

Andrew Fedoniouk.

Received on Thursday, 10 July 2008 22:59:30 UTC

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