[whatwg] defer on style, depends
bzbarsky at MIT.EDU
Sun Feb 15 13:21:57 PST 2009
Garrett Smith wrote:
> I can see why rule matching would happen for all nodes in the document.
> On what occasion(s) do(es) that algorithm run?
Depends on the UA, probably.
For Gecko in particular, any time a stylesheet is added to or removed
from the document, any time a rule is added to or removed from a
stylesheet via the CSSOM, and any time a rule is changed via the CSSOM.
The one exception is inline style; changing that only performs style
recomputation (which includes selector matching) on the subtree rooted
at the node whose inline style has changed.
In general, the whole setup in Gecko is optimized around changes to
nodes being common and changes to stylesheets being rare.
So far this is a good working assumption; if that ever changes we'll
look into optimizing changes to stylesheets more.
> Could such a strategy for rule-matching help performance, or would it
> hinder performance or be too much work to maintain?
To a first approximation it'd have no effect on performance.
>> Too complicated for whom? The author or the implementation?
> For the implementation, I do not actually know because I have not
> worked on that code. What are your thoughts?
I haven't thought about this enough to have any useful ones yet.
More information about the whatwg