W3C home > Mailing lists > Public > www-style@w3.org > November 2011

Re: a recall for a missing combinator

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Wed, 16 Nov 2011 11:06:02 +1300
Message-ID: <4EC2E24A.8020705@mit.edu>
To: www-style@w3.org
On 11/16/11 4:49 AM, Tab Atkins Jr. wrote:
> I approve of this.  Let's call it the "closest descendant" combinator.
>   Perhaps it could look like ">>".

What would it match, exactly?  Recall that the requirement is to have 
something that given this markup:

   <article class=”product>
                 <header>…</header>
                 <div class=”main”>
                                <article class=”review”>
                                                <header>…</header>
                                                …
                                </article>
                 </div>
   </ article>

matches only the first <header>.

Seems to me like that's already possible with the proposed changes to 
:not, by the way:

   article.product header:not(article.review header)

> It's like the descendant
> combinator, except when you're walking up the tree to find the
> ancestor, you *also* look for someone else that matches the
> descendant.

If you just did that then you would match both <header>s in the testcase 
above.  So that doesn't work to address the use case put forward.

-Boris
Received on Tuesday, 15 November 2011 22:06:45 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:46 GMT