toothbrush7777777 / domready

Automatically exported from code.google.com/p/domready
0 stars 0 forks source link

Don't call ready events in a loop #2

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
If one of the ready callbacks fails, all subsequent ones will, too. I would 
suggest calling window.setTimeout(callback, 0), they will then be executed by 
the browser independently of each other, and errors will be reported 
individually to the browser too.

Original issue reported on code.google.com by sc...@olx.com on 6 Feb 2012 at 6:07

GoogleCodeExporter commented 9 years ago
To clarify:

for(var fn = 0; fn < readyList.length; fn++) {
    window.setTimeout(readyList[i], 0);
}

Original comment by sc...@olx.com on 6 Feb 2012 at 6:10