W3C home > Mailing lists > Public > whatwg@whatwg.org > February 2010

[whatwg] DOMContentLoaded and stylesheets

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Wed, 10 Feb 2010 19:16:23 -0500
Message-ID: <4B734C57.7000005@mit.edu>
On 2/10/10 6:55 PM, Mathias Sch?fer wrote:
> In a JavaScript tutorial, I wanted to explain what DOMContentLoaded
> actually does.

It fires once the parser has consumed the entire input stream, such that 
you can rely on all the parser-created DOM nodes being present.  This is 
true in all implementations of DOMContentLoaded.  What is not consistent 
is the ordering of this event with the loading of various subresources.

> 1. Am I right that HTML5 will standardize Opera's pure DOMContentLoaded
> model, never waiting for stylesheets? My assumption is that this will
> break compatibility with the current Gecko and Webkit implementations.

Gecko currently does not wait on stylesheet loads to complete before 
firing DOMContentLoaded.  They might complete before the parser is done, 
or they might not.

> 2. Does the HTML5 parser specify that external stylesheets defer
> external script execution? As far as I understand the specs, it doesn't.

http://www.whatwg.org/specs/web-apps/current-work/multipage/scripting-1.html#running-a-script 
step 8 the cases that talk about "a style sheet blocking scripts" 
specify this.

I really wish those steps had individual IDs, and so did the cases 
inside them.  It'd make it a lot easier to link to them!

> In Gecko and IE, the loading of stylesheets also defers the execution of
> subsequent *inline* scripts. I haven't found a rule for that in the
> HTML5 parsing algorithm either.

See above.

-Boris
Received on Wednesday, 10 February 2010 16:16:23 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:21 UTC