Re: Direct adjacent sibling selector (+)

Bjoern Hoehrmann wrote:
> 
> * fantasai wrote:
> ><blockquote>
> >  Adjacent sibling selectors have the following syntax:
> >  E1 + E2, where E2 is the subject of the selector. The
> >  selector matches if E1 and E2 share the same parent in
> >  the document tree and E1 immediately precedes E2.
> ></blockquote>
> >
> >Would E2 be selected by E1 + E2 for
> ><Parent>
> >  <E1/>
> >  Some text
> >  <E2/>
> ></Parent>
> >?
> 
> Yes, there is no _element_ between E1 and E2. W3C Selectors always
> select an element and all their text nodes. The current draft is 
> somewhat clearer:
> 
> [...]
> 8.3.1 Direct adjacent combinators
> 
> Direct adjacent combinators are made of the "+" character that separates
> two sequences of simple selectors. The elements represented by the two
> sequences share the same parent in the document tree and the element
> represented by the first sequence immediately precedes the element
> represented by the second one.
> [...]

It's still ambiguous.

Does "immediately precedes" take text nodes into account? 
Or does it deal exclusively with the -element- tree? 
I can construe the selector E1 + E2 to mean that E2 will 
only be selected in such a case:

<Parent>
  <E1/><E2/>
</Parent>

and not in the this case:

<Parent>
  <E1/>Some text<E2/>
</Parent>

Received on Tuesday, 27 February 2001 18:18:48 UTC