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

Re: First-descendant-of-type selector?

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Sat, 02 Sep 2006 19:08:16 +0200
To: dolphinling <lists@dolphinling.net>
Cc: W3C CSS List <www-style@w3.org>
Message-ID: <e6cjf25c2bc3th90d85el9ghmcv8jhm2uv@hive.bjoern.hoehrmann.de>

* dolphinling wrote:
>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.)

Then you are looking for all li elements whose closest ancestor ul
element is equal to the element with ID 'a'. That's trivial in XPath,

  //li[ ancestor::ul[1] = id('a') ]

You cannot create a equivalent CSS Selector without the notion of
"closest ancestor" or "immediate descendants" if you begin the ex-
pression with the ul element. What you can do, of course, is

  ul#a li    { ... }
  ul#a ul li { ... }
  ...

which would cover most, if not all, use cases, as far as style
sheet authoring is concerned.
-- 
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 
Received on Saturday, 2 September 2006 17:08:57 GMT

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