W3C home > Mailing lists > Public > www-style@w3.org > October 2005

Re: Styling by attribute-based association?

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Tue, 25 Oct 2005 16:34:21 -0500
Message-ID: <435EA4DD.6070000@mit.edu>
To: Ian Hickson <ian@hixie.ch>
CC: W3C CSS <www-style@w3.org>

Ian Hickson wrote:
>    label:friend(for, [type=date]) { ... }
> 
> ...would select all labels pointing at elements with type="date".
> 
> This selector wouldn't be expensive to process, particularly (it wouldn't 
> be cheap, but it doesn't have the potential to run away scanning the 
> entire DOM tree or anything, assuming IDs are cached).

This selector is not expensive to match on if you're already resolving 
style for the element.  It's expensive in the face of dynamic updates, 
though.  Whenever a node is removed from the DOM or the ID of a node 
changes, you have to walk the whole DOM looking for labels that pointed 
to the old id and changing their style.

That is, this selector is good at defeating attempts to not recompute 
style for the entire DOM on DOM mutations.

-Boris
Received on Tuesday, 25 October 2005 21:34:53 GMT

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