Re: [css3-selectors] :parent selector

Le Sun, 24 Sep 2006 16:00:16 +0300, David Woolley  
<david@djwhome.demon.co.uk> a écrit:

>> :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:
>
> What happens if the relevant child is a several mega bytes down a
> streamed document?  In particular, what happens if it changes the
> display mode, in particular to none.

Answer: If you are asking what happens if child:parent is set to  
display:none, then the answer is that the parent disappears. Why would  
this be a problem?

Discussion:

A several mega bytes streamed document is something I have yet to use over  
the web. A several MB document is something that poses problems in current  
proeminent UAs as well (e.g. Opera, Gecko, KHTML, WebKit and Trident).  
Having a "complex" CSS layout with a navigation bar, CSS sub menus (with  
:hover), rounded boxes (yeah, these days we all want "beautiful" layouts),  
is rather slow at times on an AMD Duron 1.3 Ghz in todays UAs. The  
document is not even 300 KB.

We can't talk of MBs since current CSS implementations are not usable  
today with huge documents as these. Thus, :parent would not be a problem  
all by itself. Yes, :parent adds further more to the processing, any new  
CSS selector, any new CSS property, any new spec implementation (such as,  
but not limited to, XBL2 and SVG) make The Web slower. Yet, this not a  
reason for everybody to stop working, stop adding, while just making  
implementations faster, with fixed bugs.

There are already tutorials on how to optimize your JavaScript code, DOM  
manipulation and CSS layouts, for performance purposes.

There are currently implemented CSS properties slowing down pages: nobody  
complains. Why? We don't yet work with documents of several mega bytes.

Having :parent is not only about speed. It's about limiting or not the  
capabilities given to web developers. XBL2 is IMHO several Ghz harder to  
implement and slower when running in complex layouts. Is this a problem?  
No, as long as you learn to use it properly.

The same applies to :parent, to any CSS selector and to any new or old web  
technology. If the developer bases his/her entire layout on complex CSS  
selectors, pseudo-elements, whatever, then he/she must live with the  
result - a slow web page on older machines. We are already seeing for a  
few years Flash documents developed for powerful machines.

It's a matter of choice.

> Generally, I don't think you have considered incremental rendering and
> you haven't really considered that a parent can have indefinitely large
> numbers of children.

This is true.

My request for :parent and possibly all other similar requests come from  
web authors, not from people who implement such technologies.

However, when working with such technologies implementors generally think  
differently than the masses of web authors just using what's given. We are  
probably getting to the discussion about "what web authors want versus  
what implementors want".




-- 
http://www.robodesign.ro
ROBO Design - We bring you the future

Received on Sunday, 24 September 2006 14:19:40 UTC