Re: First-descendant-of-type selector?

* dolphinling wrote:
>Suppose HTML were extended so that <li> had to be a descendant of <ul>, but not
>necessarily a child: there could be another element (or multiple elements)
>between them. Is there any way to reliably select the <li>(s) in that case?

ul *:not(ul) > li { ... } /* or ...:not(ul):not(ol)... */

>ul > li {}; obviously doesn't work, since li isn't the child.
>ul li {}; doesn't work, because of the case <ul><foo><li><ul><li>
>     (there's another list inside the one we're looking at)

I assume that your selector only fails to meet your requirements because
it selects the li in the inner list even though it is a child of the ul
element. If that is not the problem, and you only want to look at outer
lists, then this is impossible to achieve using CSS Selectors. Also note
that there is generally no need to select the specific list items in one
step, you could just combine

  ul * li { ... }
  ul > li { ... }

or whatever you are really trying to achieve. If you need something more
sophisticated, you should use a real selection language like XPath.
-- 
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 Wednesday, 30 August 2006 21:04:55 UTC