MCPcopy Index your code
hub / github.com/JsAaron/jQuery / bindReady

Function bindReady

1.2.6/src/event.js:515–573  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

513var readyBound = false;
514
515function bindReady(){
516 if ( readyBound ) return;
517 readyBound = true;
518
519 // Mozilla, Opera (see further below for it) and webkit nightlies currently support this event
520 if ( document.addEventListener && !jQuery.browser.opera)
521 // Use the handy event callback
522 document.addEventListener( "DOMContentLoaded", jQuery.ready, false );
523
524 // If IE is used and is not in a frame
525 // Continually check to see if the document is ready
526 if ( jQuery.browser.msie && window == top ) (function(){
527 if (jQuery.isReady) return;
528 try {
529 // If IE is used, use the trick by Diego Perini
530 // http://javascript.nwbox.com/IEContentLoaded/
531 document.documentElement.doScroll("left");
532 } catch( error ) {
533 setTimeout( arguments.callee, 0 );
534 return;
535 }
536 // and execute any waiting functions
537 jQuery.ready();
538 })();
539
540 if ( jQuery.browser.opera )
541 document.addEventListener( "DOMContentLoaded", function () {
542 if (jQuery.isReady) return;
543 for (var i = 0; i < document.styleSheets.length; i++)
544 if (document.styleSheets[i].disabled) {
545 setTimeout( arguments.callee, 0 );
546 return;
547 }
548 // and execute any waiting functions
549 jQuery.ready();
550 }, false);
551
552 if ( jQuery.browser.safari ) {
553 var numStyles;
554 (function(){
555 if (jQuery.isReady) return;
556 if ( document.readyState != "loaded" && document.readyState != "complete" ) {
557 setTimeout( arguments.callee, 0 );
558 return;
559 }
560 if ( numStyles === undefined )
561 numStyles = jQuery("style, link[rel=stylesheet]").length;
562 if ( document.styleSheets.length != numStyles ) {
563 setTimeout( arguments.callee, 0 );
564 return;
565 }
566 // and execute any waiting functions
567 jQuery.ready();
568 })();
569 }
570
571 // A fallback to window.onload, that will always work
572 jQuery.event.add( window, "load", jQuery.ready );

Callers 1

event.jsFile · 0.85

Calls 1

jQueryFunction · 0.50

Tested by

no test coverage detected