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

Re: Parent Combinator / Parent pseudo-class

From: Brad Kemper <brkemper@comcast.net>
Date: Fri, 25 Jul 2008 08:56:53 -0700
To: "Francois Remy" <fremycompany_pub@yahoo.fr>
Message-Id: <C1C217AF-0363-4967-AF6E-DBA87F129CBB@comcast.net>
Cc: "Andrew Fedoniouk" <news@terrainformatica.com>, "Boris Zbarsky" <bzbarsky@MIT.EDU>, "www-style list" <www-style@w3.org>

On Jul 25, 2008, at 8:20 AM, Francois Remy wrote:

> From: "Brad Kemper" <brkemper@comcast.net>
>> On Jul 24, 2008, at 10:01 PM, Andrew Fedoniouk wrote:
>>> Second:
>>> Consider these two selectors:
>>> p
>>> {
>>>   border: none;
>>> }
>>> html:with-child(a:hover) p
>>> {
>>>   border: 2em;
>>> }
>>> and markup:
>>> <html>
>>> <p><a href="*">sample</a></p>
>>> </html>
>> As far as I can tell, nothing would happen there, because the HTML   
>> element does not have an anchor ("A" element) as a child. It only  
>> has  one as a descendant, and I thought "with-child" referred to  
>> immediate  children only, not grandchildren.
> No with-child refers to grandchildren too.
> But it's possible that the name is bad choosen.
> Fremy

Well then, I think we should consider single generation version of  
this idea, especially if it will make it faster. Most of the use cases  
involve just children, not all descendants. In fact, I think it would  
be more useful if it had the more limited scope of just immediate  

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. I can really see no use case for a "has-child" pseudo- 
class to look at all descendants.
Received on Friday, 25 July 2008 15:57:48 GMT

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