W3C home > Mailing lists > Public > www-style@w3.org > July 2008

Re: Parent Combinator / Parent pseudo-class

From: Andrew Fedoniouk <news@terrainformatica.com>
Date: Fri, 25 Jul 2008 14:30:17 -0700
Message-ID: <488A45E9.5070902@terrainformatica.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
CC: Brad Kemper <brkemper@comcast.net>, Francois Remy <fremycompany_pub@yahoo.fr>, Boris Zbarsky <bzbarsky@mit.edu>, www-style list <www-style@w3.org>

Tab Atkins Jr. wrote:
> On Fri, Jul 25, 2008 at 10:56 AM, Brad Kemper <brkemper@comcast.net 
> <mailto:brkemper@comcast.net>> wrote:
>
>
>     Consider the following:
>
>     div:with-child(code) { border:2px solid #999;
>     background-color:beige; }
>     div:with-child(code):before { content:"See Code:"; }
>
>     I would only want this on DIVs that surrounded the Code block
>     directly, not on any old DIV that happened to be an ancestor of
>     the code block.
>
>
> Nod, searching for just children would certainly be useful.  That's 
> why my proposal was for a simple selector preceded by a combinator.  
> You'd do this:
>
> div:matches( > code ) { border:2px solid #999; background-color:beige; }
> div:matches( > code ):before { content:"See Code:"; }
That is again subject of :root/:scope debate :)
>
>     I can really see no use case for a "has-child" pseudo-class to
>     look at all descendants.
>
>
> Really?  I can.  I probably wouldn't ever want to use a plain 
> descendant selector on something like a plain div, but I could easily 
> see this being used on a more complex element about which you have a 
> greater knowledge of it's use.  Frex:

As a solution: http://www.terrainformatica.com/?p=100

Cheers.

--

Andrew Fedoniouk.

http://terrainformatica.com
Received on Friday, 25 July 2008 21:31:11 GMT

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