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>

Hello!

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.

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

.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:

http://lists.w3.org/Archives/Public/www-style/2006Aug/0144.html

(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>
testing
</div>

.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.


-- 
http://www.robodesign.ro
ROBO Design - We bring you the future
Received on Sunday, 24 September 2006 09:29:39 GMT

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