W3C home > Mailing lists > Public > www-style@w3.org > September 2006

Re: First-descendant-of-type selector?

From: dolphinling <lists@dolphinling.net>
Date: Sat, 02 Sep 2006 12:19:25 -0400
Message-ID: <44F9AF0D.5070702@dolphinling.net>
To: W3C CSS List <www-style@w3.org>
CC: Lachlan Hunt <lachlan.hunt@lachy.id.au>

Lachlan Hunt wrote:
> 
> Andrew Fedoniouk wrote:
>> If :not will be relaxed to contain not only simple selectors
>> then selector
>> [...]
>> Say selector like
>> X Y:not(X > Y)
>> naturally complements "X Y" and "X>Y" selectors.
> 
> I think that would be equivalent to this:
> 
> X :not(X)>Y
> 
> Both would select a Y that is a descendant (but not a child) of an X.

That's very close, but unfortunately it doesn't work.

Take this case:

<ul id="a">
   <foo>
     <li>text</li>
     <li>
       <ul id="b">
         <bar>
           <li>text<li>
         </bar>
         <li>text</li>
       </ul>
     </li>
   </foo>
</ul>

In this case,
ul#a :not(ul#a)>li
selects the <li> inside <bar>, even though it's not an item of list a. (This is 
the same problem with Bjoern's nearly-identical solution above.)

-- 
dolphinling
<http://dolphinling.net/>
Received on Saturday, 2 September 2006 16:19:59 GMT

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