W3C home > Mailing lists > Public > public-html@w3.org > July 2009

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

From: Maciej Stachowiak <mjs@apple.com>
Date: Wed, 22 Jul 2009 19:40:29 -0700
Cc: "public-html@w3.org" <public-html@w3.org>, Jacob Rossi <t-jacobr@microsoft.com>, Kirk Sykora <ksykora@microsoft.com>, Harley Rosnow <Harley.Rosnow@microsoft.com>
Message-id: <600D6ED5-A64D-42CF-B1A9-751177533235@apple.com>
To: Travis Leithead <travil@microsoft.com>

On Jul 22, 2009, at 6:45 PM, Travis Leithead wrote:

> I hope someone can clarify this question: What’s the “desired”  
> behavior of DOMContentLoaded with regard to CSS resources and why?
> At least two implementations wait to fire DOMContentLoaded until  
> after the CSS resources have loaded. I believe that JQuery may  
> depend on this behavior—but I’m not sure why. However, if I read  
> HTML5 correctly, this event fires immediately after parsing and  
> pending script content has finished, but does not appear to wait for  
> CSS resources. Opera fires the event in this way--as it appears to  
> be speced, but the spec’d behavior does not appear to be  
> “interoperable” universally.
> Is the currently speced behavior “by design?” If so, please explain  
> why..
> Else, perhaps it could be spec’d to match the Firefox/Webkit approach?

 From the implementation, it looks like WebKit dispatches  
DOMContentLoaded when the document is finished parsing, and does not  
explicitly wait for stylesheets. However, if we encounter a <script>  
element while a stylesheet load is pending, we block parsing until the  
stylesheet is loaded. We used to not do that, but it turned out to be  
necessary for Web compatibility. I think Gecko may always block  
parsing on stylesheet loads, or at least does so in the same cases as  
we do.

Received on Thursday, 23 July 2009 02:41:12 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 29 October 2015 10:15:48 UTC