W3C home > Mailing lists > Public > www-style@w3.org > September 2006

[css3-selectors] :parent selector

From: Mihai Sucan <mihai.sucan@gmail.com>
Date: Sun, 24 Sep 2006 12:29:26 +0300
To: www-style@w3.org
Message-ID: <op.tgdlzcxemcpsjgr0b0dp@localhost.localdomain>


Yes, I have searched the archives and I know this has been requested many  
times before. However, I have a slightly different proposal and perhaps  
it's not as inefficient as others (performance-wise).

New pseudo-thing :parent.

<p class="sample">example</p>

.sample:parent { color: red } which makes "testing" and "example" colored  
in red.

This is more limited than what was proposed in the very recent thread:


(That thread turned into an off-topic discussion, after being rejected)

If I am not mistaken, this should not add very much to the complexity of  
CSS render engines. It should behave much like any new CSS3 Selector.

:parent would pick parentNode, it's not picking *which* parent node, it  
doesn't need any further checks. It would work as if the following snippet  
was given:

<div class="internal-parent-class-1">
<p class="sample">example</p>

.internal-parent-class-1 { color: red }

It's obvious web developers really need something like this - efficient or  
not. It's not rare at all to have the need of using something like this.  
Also, the need is not always caused by bad design, nor wrong layout.

If the aboive is still too inefficient to make it into the CSS 3 Selectors  
specification, I'm quite curious why would the above be more complex than  
::first-letter, ::first-line, ::before and ::after ? To me, it's a lot  
more complex to insert into the "internal" DOM pseudo-elements, instead of  
picking the parentNode and just apply the given properties.

Apologies for bringing back a much debated topic.

ROBO Design - We bring you the future
Received on Sunday, 24 September 2006 09:29:39 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:26 UTC