RE: [css3-selectors] :parent selector

> From: www-style-request@w3.org [mailto:www-style-request@w3.org] On Behalf Of Mihai Sucan
> Sent: Monday, September 25, 2006 2:59 AM
> To: David Hyatt; Patrick Lauke
> Cc: www-style@w3.org
> Subject: Re: [css3-selectors] :parent selector
> 
> 
> Le Mon, 25 Sep 2006 11:54:56 +0300, David Hyatt <hyatt@apple.com> a écrit:
> 
> > As I've said a couple of times before, my real objections to a parent  
> > selector are
> >
> > (a) I don't like selectors that are incompatible with incremental  
> > rendering (since you risk displaying incorrectly styled content when  
> > doing incremental rendering while a page loads).  (This problem would be  
> > especially bad for parent selectors... moreso than say, :last-child).
> >
> > and
> >
> > (b) The performance of this selector would be terrible.
> >
> > dave
> > (hyatt@apple.com)
> 
> Some people can live with both.
> 
> Please explain to us why is incremental rendering extremely important? Is  
> it very bad if parent selector styling would be applied only at the end? 
> Everything else, just like now. Oh, and at the end, a better algorithm  
> could be used (such as the one I suggested?).

The problem with mixed model is not even that some documents might never fully load - one could apply :parent selectors when all the children of the element are known. The biggest problem that I see is that you really cannot apply a specific rule to many elements because the cascade needs to be performed. For each element you have to find *all* rules (or at least the rules with higher specificity) and apply them all together. So to apply :parent selector you'd have to search for all the elements that match it and fully recascade all stylesheets for such elements (which in practice also means recascading all their children - because of inheritance). It is still possible to do incremental rendering this way, but in addition to cascading styles on each element as it is being parsed (small lookahead is still needed in practice), one would have to go and totally recascade parent element if any :parent selectors ends up matching. So this selector would require some re-architecture of the browser and it would work slower (and somewhat differently) than other selectors. On the other hand the usefulness of it is questionable (I agree with Dave that assigning more specific classes just works better than complex selectors in practice).

Peter

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

Received on Monday, 25 September 2006 17:52:35 UTC