[whatwg] DOMContentLoaded and stylesheets

Hello everyone,

In a JavaScript tutorial, I wanted to explain what DOMContentLoaded
actually does. But the tests I made revealed that there isn't a
consistent behavior across browsers with regard to stylesheets. In fact,
it's a total mess. These are the results of my tests:

http://molily.de/weblog/domcontentloaded

Please have a quick look at these findings (you can skip the
introduction part). My questions are:

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.

2. Does the HTML5 parser specify that external stylesheets defer
external script execution? As far as I understand the specs, it doesn't.
But according to my tests, that's how it is implemented in Gecko, WebKit
and Internet Explorer. Many scripts on the Web seem to rely on this
non-standard feature.

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. Does it conform to the specs, is it
against the rules or a legitimate extension which is not covered by HTML5?

3. If I'm right in my conclusions, could HTML5 provide a solution for
this quirks? Does HTML5 require browsers to change their parsing
behavior with regard to stylesheets as well as their DOMContentLoaded
handling? Is it likely that the browser vendors will do so? What would
be a proper solution?

(By the way, I tried the experimental HTML5 parser in Gecko, but it
seems to apply the same rules as the standard parser.)

Regards,
Mathias

Received on Wednesday, 10 February 2010 15:55:19 UTC