W3C home > Mailing lists > Public > www-style@w3.org > April 2007

Re: Select a parrent node with s CSS selector?

From: Steven Pemberton <steven.pemberton@cwi.nl>
Date: Tue, 24 Apr 2007 23:33:57 +0200
To: "Andrew Fedoniouk" <news@terrainformatica.com>, "Ilia Goranov" <css-babailiica@babailiica.com>, www-style@w3.org
Message-ID: <op.tra4uvbksmjzpq@acer3010.lan>

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:50 GMT