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

Re: Select a parrent node with s CSS selector?

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Tue, 24 Apr 2007 16:53:52 -0500
Message-ID: <462E7C70.9010907@mit.edu>
To: Steven Pemberton <steven.pemberton@cwi.nl>
CC: www-style@w3.org

Steven Pemberton wrote:
> 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.

Yes.  Furthermore, the style of a node only depends on its ancestors.  So when 
something about a node changes, you only need to recompute style on its descendants.

> 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.

For computing style on a single node, yes.  But for deciding what nodes to 
restyle when something about a node changes, the presence of both "<" and ">" 
means having to restyle the entire document tree (modulo memory-consuming 
optimizations).

Again, the performance issues with all the "parent" proposals are not in 
computing style for a single node.  They're in handling DOM mutations.  Which 
happen a good bit out there.

-Boris
Received on Tuesday, 24 April 2007 21:54:07 GMT

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