| @@ 444-487 (lines=44) @@ | ||
| 441 | } |
|
| 442 | }, |
|
| 443 | ||
| 444 | bindReady: function() { |
|
| 445 | if ( readyList ) { |
|
| 446 | return; |
|
| 447 | } |
|
| 448 | ||
| 449 | readyList = jQuery.Callbacks( "once memory" ); |
|
| 450 | ||
| 451 | // Catch cases where $(document).ready() is called after the |
|
| 452 | // browser event has already occurred. |
|
| 453 | if ( document.readyState === "complete" ) { |
|
| 454 | // Handle it asynchronously to allow scripts the opportunity to delay ready |
|
| 455 | return setTimeout( jQuery.ready, 1 ); |
|
| 456 | } |
|
| 457 | ||
| 458 | // Mozilla, Opera and webkit nightlies currently support this event |
|
| 459 | if ( document.addEventListener ) { |
|
| 460 | // Use the handy event callback |
|
| 461 | document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); |
|
| 462 | ||
| 463 | // A fallback to window.onload, that will always work |
|
| 464 | window.addEventListener( "load", jQuery.ready, false ); |
|
| 465 | ||
| 466 | // If IE event model is used |
|
| 467 | } else if ( document.attachEvent ) { |
|
| 468 | // ensure firing before onload, |
|
| 469 | // maybe late but safe also for iframes |
|
| 470 | document.attachEvent( "onreadystatechange", DOMContentLoaded ); |
|
| 471 | ||
| 472 | // A fallback to window.onload, that will always work |
|
| 473 | window.attachEvent( "onload", jQuery.ready ); |
|
| 474 | ||
| 475 | // If IE and not a frame |
|
| 476 | // continually check to see if the document is ready |
|
| 477 | var toplevel = false; |
|
| 478 | ||
| 479 | try { |
|
| 480 | toplevel = window.frameElement == null; |
|
| 481 | } catch(e) {} |
|
| 482 | ||
| 483 | if ( document.documentElement.doScroll && toplevel ) { |
|
| 484 | doScrollCheck(); |
|
| 485 | } |
|
| 486 | } |
|
| 487 | }, |
|
| 488 | ||
| 489 | // See test/unit/core.js for details concerning isFunction. |
|
| 490 | // Since version 1.3, DOM methods and functions like alert |
|
| @@ 429-472 (lines=44) @@ | ||
| 426 | } |
|
| 427 | }, |
|
| 428 | ||
| 429 | bindReady: function() { |
|
| 430 | if ( readyBound ) { |
|
| 431 | return; |
|
| 432 | } |
|
| 433 | ||
| 434 | readyBound = true; |
|
| 435 | ||
| 436 | // Catch cases where $(document).ready() is called after the |
|
| 437 | // browser event has already occurred. |
|
| 438 | if ( document.readyState === "complete" ) { |
|
| 439 | // Handle it asynchronously to allow scripts the opportunity to delay ready |
|
| 440 | return setTimeout( jQuery.ready, 1 ); |
|
| 441 | } |
|
| 442 | ||
| 443 | // Mozilla, Opera and webkit nightlies currently support this event |
|
| 444 | if ( document.addEventListener ) { |
|
| 445 | // Use the handy event callback |
|
| 446 | document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); |
|
| 447 | ||
| 448 | // A fallback to window.onload, that will always work |
|
| 449 | window.addEventListener( "load", jQuery.ready, false ); |
|
| 450 | ||
| 451 | // If IE event model is used |
|
| 452 | } else if ( document.attachEvent ) { |
|
| 453 | // ensure firing before onload, |
|
| 454 | // maybe late but safe also for iframes |
|
| 455 | document.attachEvent("onreadystatechange", DOMContentLoaded); |
|
| 456 | ||
| 457 | // A fallback to window.onload, that will always work |
|
| 458 | window.attachEvent( "onload", jQuery.ready ); |
|
| 459 | ||
| 460 | // If IE and not a frame |
|
| 461 | // continually check to see if the document is ready |
|
| 462 | var toplevel = false; |
|
| 463 | ||
| 464 | try { |
|
| 465 | toplevel = window.frameElement == null; |
|
| 466 | } catch(e) {} |
|
| 467 | ||
| 468 | if ( document.documentElement.doScroll && toplevel ) { |
|
| 469 | doScrollCheck(); |
|
| 470 | } |
|
| 471 | } |
|
| 472 | }, |
|
| 473 | ||
| 474 | // See test/unit/core.js for details concerning isFunction. |
|
| 475 | // Since version 1.3, DOM methods and functions like alert |
|