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

First-descendant-of-type selector?

From: dolphinling <lists@dolphinling.net>
Date: Wed, 30 Aug 2006 16:23:04 -0400
Message-ID: <44F5F3A8.4080707@dolphinling.net>
To: W3C CSS List <www-style@w3.org>

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 > 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)
ul li:not(li li) wouldn't even work if it were valid, because of the case
     <ul><li><ul><foo><li> (the list we're looking at is inside another list)
ul#id li:not(ul#id li li) seems like it would work if it were valid, but it's
     NOT valid, and it's a pain to write and requires the id to be present in the
     markup.


Note that this isn't entirely academic, as there's been talk in the WHATWG about 
  allowing <ins>, <del>, <fieldset>, and perhaps others that would make sense 
there. It almost certainly won't happen for HTML5 since it wouldn't be backwards 
compatible parsing-wise, but there's no reason another the XHTML version of 
HTML5 couldn't have it (since XML parsing rules would require it to work as 
expected), or some other markup language could allow a similar construct.

-- 
dolphinling
<http://dolphinling.net/>
Received on Wednesday, 30 August 2006 20:23:59 GMT

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