Re: Styling by attribute-based association?

On Tue, 25 Oct 2005, Boris Zbarsky wrote:

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

Yeah, good point. (And the same the other way around, looking for labels 
that now apply to it and didn't before.)

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Tuesday, 25 October 2005 21:48:01 UTC