Re: DOMContentLoaded

On Mon, 09 Jul 2007 04:12:14 +0200, Boris Zbarsky <bzbarsky@MIT.EDU> wrote:

> Nicolas Mendoza wrote:
>> Specifically, with Mozilla Firefox, CSS style attributes from external  
>> stylesheets are applied to the DOM tree before DOMContentLoaded is  
>> fired.
>
> In Mozilla DOMContentLoaded is fired when the end of the document is  
> parsed (the </html> in HTML documents).
>
> Depending on timing of network events, stylesheets may or may not have  
> loaded before then.
>
> Note that released Gecko builds block the parser on stylesheets just  
> like they do for scripts.  Thus DOMContentLoaded always fires after  
> stylesheets have loaded in release Geckos.  That's not going to be the  
> case in Gecko 1.9.
>
>> In Opera it's fired when the tree is done and styles are applied later.
>
> I find it hard to believe that this is true in all cases, because this  
> would imply that Opera doesn't do incremental rendering.  My experience  
> is that it does.
>

Try adjusting the timeout:

http://people.opera.com/nicolasm/test/domcontentloaded.html?timeout=10
http://people.opera.com/nicolasm/test/domcontentloaded.html?timeout=60

Even with a 60 timeout on the external CSS the DOMContentLoaded doesn't  
seem to be fired until the style is applied to the document.

Anyway it's not that important what it actually does, as long as it's  
defined somewhere what it is supposed to do. And as mentioned in the blog  
post, it could be fatal if DOMContentLoaded is used with common 3rd party  
libs that expect styles to already have been applied when being run. One  
might want to think of having events with higher granularity being fired  
during a loading/parsing process.

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

Received on Monday, 9 July 2007 03:11:58 UTC