views:

813

answers:

2

With which will function(){} fire first?

A) window.addEvent('domready', function(){});
B) window.addEvent('load', function(){});
+6  A: 

domready will fire first.

http://demos111.mootools.net/DomReadyVS.Load

Björn
sometimes it fires too soon in IE with 1.11, i have been forced to use load instead.
Dimitar Christoff
@JamesBrownIsDead -- the concept of the domready event is that the structure of the html and the resulting DOM (document object model) will have loaded. So, the "skeleton" of the page has loaded. While load is the event that fires once all that is done AS WELL AS all the images and whatever other ancillary content files.
artlung
+1  A: 

domready comes first as load waits till everything on the page is loaded before executing.

The Web Savant