W3C home > Mailing lists > Public > www-style@w3.org > April 2005

Re: [selectors] Tree selectors

From: Lachlan Hunt <lachlan.hunt@lachy.id.au>
Date: Sat, 02 Apr 2005 21:52:54 +1000
Message-ID: <424E8796.1050709@lachy.id.au>
To: Anne van Kesteren <fora@annevankesteren.nl>
CC: W3C CSS List <www-style@w3.org>

Anne van Kesteren wrote:
> The current Selectors specification ([css3-selectors]) defines various 
> methods for selecting siblings using :nth-child. However, it does not 
> define such a method for trees. For example:
> ...
> ... there is no way to select all "even" or all "odd", which is possible 
> when you do not have a tree but a list of siblings:
> ... I think some :depth(arg) pseudo-class or other method should be 
> designed to have similar options for trees.

I proposed a several similar ideas to this in 2003-12.  One used several 
pseudo-classes for selecting various nth-decendants (like nth-child, but 
working with trees like :depth()) and another using a combinator.  As 
was discussed in the thread [1], the pseudo-classes were innappropriate, 
specifically for the reasons given by Ernest Cline [2].  I believe, if 
I'm understanding this proposal and this is in any way similar to my 
earlier proposals, this wouldn't wouldn't work for the same reason.

However, I think the combinator idea I had, which wasn't discussed much 
(nor rejected) at the time may still be a good idea, and it may be able 
to achieve the desired result of :depth().

In summary, the combinator (^) idea [3] was this:
body > section ^ section

Would select the second level section element, regardless of any 
elements in between.


       <section> <-- Selects this one -->

I think this would be equivlent to the proposed selector:
(that is, if I understood :depth() correctly).

[1] http://lists.w3.org/Archives/Public/www-style/2003Dec/thread.html#34
[2] http://lists.w3.org/Archives/Public/www-style/2003Dec/0063.html
[3] (Specifically, the section under the heading "-- Combinator --")

Lachlan Hunt
http://GetFirefox.com/     Rediscover the Web
http://GetThunderbird.com/ Reclaim your Inbox
Received on Saturday, 2 April 2005 11:57:25 UTC

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