Re: Select a parrent node with s CSS selector?

On Mon, 23 Apr 2007 09:25:32 +0200, Andrew Fedoniouk  
<news@terrainformatica.com> wrote:
> >   ----- Original Message -----
> >   From: Ilia Goranov
...
> >   My proposal to the working group is to use the "less than" character  
> - > closing tag brace to set to which part of the selector the rule have  
> to > apply. In the example above:
> >
> >   body>div.content p.description<a:link

> So to find style of p.description CSS engine will need to scan
> 1) all parents ( for body>div.content )
> 2) *and* all it is children ( for a:link )
>
> Computational complexity of style resolving is O( n * m * d)  currently
> where n - number of DOM elements,
> m - number of styles.
>
> Your proposal changes the compelxity to O( n * n * m * d )  that is  
> highly non-desirable as you may expect.

Are you sure about this? CSS is currently designed so that you can decide  
when you are at an element which styles apply, and presumably  
implementations use that knowledge. Consequently if you added this rule to  
such implementations it would indeed blow the complexity up. But it is not  
inherent complexity; since the selector ">" and the proposed "<" are  
symmetrical, I would expect at worst only a linear increase in complexity.  
It would just need a different algorithm.

Steven Pemberton

Received on Tuesday, 24 April 2007 21:34:04 UTC