- From: L. David Baron <dbaron@fas.harvard.edu>
- Date: Sun, 14 Mar 1999 10:37:47 -0500 (EST)
- To: ignacio.gomez@dicoruna.es, www-style@w3.org
On Sun, 14 Mar 1999 12:04:32 +0100, Ignacio Javier (ignacio.gomez@dicoruna.es) wrote: > > I've been thinking in this simple document structure: > <a> > <c> > </c> > </a> > <c> This one is matched by my selector. > </c> > <c> > </c> > .... > <a> > <c> > </c> > </a> > <c> And this one is matched by my selector. > </c> > <c> > </c> > .... > > For selecting the first C after A what might I do? > > A > C + C ???? If you want to select the elements that I have marked above, then the selector you want is A + C That's the only way I can interpret "the first C after A." There are no elements in the tree you give above that would be matched by the selector A > C + C This would match elements such as those marked here: <c> </c> <a> <c> </c> <c matched> <c> </c> <c> </c> </c> <c matched> </c> </a> <c> </c> > Is the interpretation of this last selector left to right or right to > left? I mean, is this (pseudonotation) > > (A>C)+C > > or > > A>(C+C) It actually doesn't matter. If you think about it the first way, then you want to match any C that are adjacent following siblings to a C that is a child of A. If you think about it the second way, you want to match any C that are are both adjacent following siblings to another C and a child of A. Since an element and its sibling must have the same parent, the selectors are equivalent, and it doesn't matter which way you think about it. One warning - right now these selectors (adjacent sibling selectors and child selectors) are only fully supported by Mozilla's NGLayout (possibly with some bugs in adjacent sibling matching). Opera 3.51 seems to support adjacent sibling selectors on some elements, but I don't really understand that. David ----------------------------------------------------------------- L. David Baron Freshman, Harvard dbaron@fas.harvard.edu Links, SatPix, CSS, etc. < http://www.fas.harvard.edu/~dbaron/ > WSP CSS AC < http://www.webstandards.org/css/ >
Received on Sunday, 14 March 1999 13:08:35 UTC