Re: [HTML5] DOMContentLoaded fires before CSS resources loaded?

On Jul 23, 2009, at 8:02 PM, Boris Zbarsky wrote:

> Travis Leithead wrote:
>> Thanks for that clarification. I'm curious what web compatibility  
>> issues motivated the change? Any pointers?
>
> I think http://webkit.org/blog/66/the-fouc-problem/ has a decent  
> summary of the problem and some of the possible solutions for it,  
> including the sorts of issues that Webkit was having with the "Don't  
> Stall" behavior (and which presumably led them to switch to their  
> current behavior).  It also describes the problems with the "Stall"  
> behavior Gecko used to have; those are not in terms of web compat  
> but in terms of performance.  There were also some internal  
> simplifications that were allowed by not stalling.
>
> Now that Gecko has reasonable speculative parsing and resource  
> prefetch, we might reevaluate returning to the "Stall" behavior at  
> some point; we've had a few reports of FOUC-type issues with our  
> current setup in some edge cases.  It hasn't been a major issue,  
> though, so chances are we won't be changing our behavior here.

Two particular things led us to change:

1) A popular third-party advertising script embedded in many Web pages  
would cause serious bad layout due to FOUC-type issues. This was  
actually more than just a flash of unstyled content, because the  
script counted on computed styles to do some sizing and positioning,  
and that ended up stuck wrong if stylesheets hadn't been loaded.

2) We added speculative parsing and preloading, which greatly reduced  
the performance cost of the "wait for stylesheets on script" model. In  
fact, we didn't see a measurable cost any more.

We're unlikely at this point to change to a full stall model,  
especially with Gecko converging on basically the same behavior.

Regards,
Maciej

Received on Friday, 24 July 2009 07:32:13 UTC