Re: Suggestion for CSS3 selectors (fwd)

Andrew Fedoniouk wrote:
> People, are you serious about all this?
> What CPU would you use to process this:
> :root < a:hover { color:sisyphean; font:boulder; }
> ?
> This simply means recalculation of styles and layout of all DOM elements 
> on simple a:hover. So is my question above.

How your example differs from the example below:

   :root:hover { color:sisyphean; font:boulder; }


This example is valid in present CSS, and it will hang your browser in an 
equivalent manner. So the "recalculation" is the problem, but it is a 
completely *different* problem.

> Complexity of style resolution for *single* element using
> containment selector is O(n), where n is a number of DOM elements in the 
> whole tree. So resolving the whole DOM against single containment rule 
> is O(n*n). This will not fly.

Yes, in certain computation models, style *resolution* would be an obvious 
problem. But the proposal is about how to change the computation model, 
isn't it? In particular, it was proposed not to match the ancestor node, and 
not to scan the tree into depth, but to match the most descendant node, and 
update the certain properties of the ancestor node.

This model would require us to store something in each node on the path from 
ancestor to descendant, thus I'm still not sure whether it's viable, but the 
model is completely different from the present model you describe.

Andrei Polushin

Received on Thursday, 1 May 2008 11:36:09 UTC