W3C home > Mailing lists > Public > www-style@w3.org > December 2003

Re: CSS3 Selector Limitations and Suggestions

From: Lachlan Hunt <lhunt07@netscape.net>
Date: Tue, 09 Dec 2003 20:23:25 +1100
Message-ID: <3FD5948D.30909@netscape.net>
To: ernestcline@mindspring.com
Cc: www-style@w3.org

ernestcline@mindspring.com wrote:

>...Your proposal simply won't work as you intend.
>Consider the following example:
><E id="a">
>  <F id="b">
>    <F id="c"/>
>  </F>
>You want E F:first-descendent to select just the element with id="b".
>You want F F:first-descendent to select just the element with id="c".
>However, the rules for selector syntax [1] state that:
>A selector consisting of a single sequence of simple selectors
>represents any element satisfying its requirements. Prepending
>another sequence of simple selectors and a combinator to a
>sequence imposes additional matching constraints, so the
>subjects of a selector are always a subset of the elements
>represented by the rightmost sequence of simple selectors.
>Thus F:first-descendent must select both of the F elements,
>as does E F:first-descendent which is not what you intend.
Thank you.  This is the most constructive feedback yet.  You have 
explained the problems with the proposal well this time.  This also 
explains why the proposed repeat syntax is also innappropriate.

>It looks like you'll have to go back to your combinator idea...
  After reading the above, I agree that the pseudo classes simply are 
not feasable to implement for the functionality required, and would 
infact cause inconsistencies with the selector syntax.  However, my 
initial combinator suggestion may not have been that far off, even 
though I'm sure there would still be many issues to be worked out.

  Although it cannot substitute for the concept of the -last-descendant 
classes, it seems that they would have very few, if any, real world 
uses.  Using the combinator '^' as I proposed earlier could infact 
substiture for the nth-descendant and nth-descendant-of-type classes, 
and the existing child selector '>' already provides the function of the 
first-descendant classes.

  As for the syntax to use for repeating selectors, already discussed, 
:rpt(an+b) is inappropriate.  I can't think of anything even worth 
considering, but hopefully someone else can.  However, it's only purpose 
would be to create a shorthand for writing long selectors with repeating 
combinators and elements, with no additional flexibility added for 
seleciting elements.  So, while conceptually very useful, it's not 
really anything that can't be handled by copying and pasting.

Received on Tuesday, 9 December 2003 04:23:31 UTC

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