- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -429,7 +429,8 @@ jQuery.extend({ | ||
// Catch cases where $(document).ready() is called after the | ||
// browser event has already occurred. | ||
if ( document.readyState === "complete" ) { | ||
return jQuery.ready(); | ||
// Handle it asynchronously to allow scripts the opportunity to delay ready | ||
return setTimeout( jQuery.ready, 13 ); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
jeresig
Author
Member
|
||
} | ||
|
||
// Mozilla, Opera and webkit nightlies currently support this event | ||
Why 13ms? From @jrburke's comment it seems that jQuery.ready just needs to be pushed to the end of the call stack; the delay doesn't matter.
From what I've read, Chrome can execute an interval/timeout as quickly as 1ms, Firefox at 10ms or ~15ms, and IE at 15ms (src: http://code.google.com/p/chromium/issues/detail?id=888#c4). In this case, where we don't care about UI responsiveness, I think a 1ms or 0 ms interval is appropriate.