In jQuery ready event logic:
// Catch cases where $(document).ready() is called after the
// browser event has already occurred.
if ( document.readyState === "complete" ) {
// Handle it asynchronously to allow scripts the opportunity to delay ready
return setTimeout( jQuery.ready, 1 );
}
Could you explain the comment: “Handle it asynchronously to allow scripts the opportunity to delay ready”.
I don’t understand what scripts and why to delay ready?
If the ready callback(which fires the
readyList) would have fire right away, you couldn’t hold it’s execution once the DOM is ready with theholdReadyfunction.jQuery.holdReady( hold )Description: Holds or releases the execution of jQuery’s ready event.