[whatwg] Scripting Tweaks

Maciej Stachowiak mjs at apple.com
Fri May 18 21:14:55 PDT 2007

On May 18, 2007, at 3:40 PM, Ian Hickson wrote:

> On Wed, 20 Apr 2005, Dean Edwards wrote:
>> 1) Mozilla's DOMContentLoaded event is very handy. It fires when a
>> node's content has been loaded and parsed (the DOM has been
>> constructed). This is much better than the standard onload event as  
>> it
>> doesn't wait for binary content to also load.
> Added.

FYI this was considered and rejected by the Web API Working Group at  
W3C for inclusion in DOM Events, I believe because there did not seem  
to be a truly valid use case (a popular use of this event is for late  
binding of script, but given the event definition and the existence of  
incremental rendering you can't actually be guaranteed the event will  
fire before any content has rendered - XBL2 potentially provides a  
better solution). I suggest referring to these discussions.

Also, <script defer> as defined in HTML5 gives you the exact same  
capabilities as DOMContentLoaded: "If the defer attribute is present,  
then the script is executed when the page has finished parsing." I'm  
not sure it's necessary to add a second way to do the same thing,  
given that the thing in question is somewhat suboptimal anyway.

That being said, I don't think it's a huge problem to add it, but you  
may want to review the arguments raised in the Web API WG.


More information about the whatwg mailing list