[css3-selectors] :parent selector

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 UTC