aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRick Waldron <waldron.rick@gmail.com>2012-12-17 16:51:59 -0500
committerRick Waldron <waldron.rick@gmail.com>2012-12-26 13:34:36 -0500
commiteb5df5e1622bcd5298ce1e3014c49233faa7a632 (patch)
tree11f4054b6c01f6fc90288427bbbe76c69b45d583
parent861a45b8fffc2073baa9f62b0648f395f0695f3e (diff)
downloadjquery-eb5df5e1622bcd5298ce1e3014c49233faa7a632.tar.gz
jquery-eb5df5e1622bcd5298ce1e3014c49233faa7a632.zip
2.0: Removes attachEvent paths for jQuery.ready()
Signed-off-by: Rick Waldron <waldron.rick@gmail.com>
-rw-r--r--src/core.js47
1 files changed, 3 insertions, 44 deletions
diff --git a/src/core.js b/src/core.js
index 656fc22f1..0bca7e369 100644
--- a/src/core.js
+++ b/src/core.js
@@ -72,15 +72,8 @@ var
// The ready event handler and self cleanup method
DOMContentLoaded = function() {
- if ( document.addEventListener ) {
- document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
- jQuery.ready();
- } else if ( document.readyState === "complete" ) {
- // we're here because readyState === "complete" in oldIE
- // which is good enough for us to call the dom ready!
- document.detachEvent( "onreadystatechange", DOMContentLoaded );
- jQuery.ready();
- }
+ document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
+ jQuery.ready();
};
jQuery.fn = jQuery.prototype = {
@@ -864,46 +857,12 @@ jQuery.ready.promise = function( obj ) {
setTimeout( jQuery.ready );
// Standards-based browsers support DOMContentLoaded
- } else if ( document.addEventListener ) {
+ } else {
// Use the handy event callback
document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
// A fallback to window.onload, that will always work
window.addEventListener( "load", jQuery.ready, false );
-
- // If IE event model is used
- } else {
- // Ensure firing before onload, maybe late but safe also for iframes
- document.attachEvent( "onreadystatechange", DOMContentLoaded );
-
- // A fallback to window.onload, that will always work
- window.attachEvent( "onload", jQuery.ready );
-
- // If IE and not a frame
- // continually check to see if the document is ready
- var top = false;
-
- try {
- top = window.frameElement == null && document.documentElement;
- } catch(e) {}
-
- if ( top && top.doScroll ) {
- (function doScrollCheck() {
- if ( !jQuery.isReady ) {
-
- try {
- // Use the trick by Diego Perini
- // http://javascript.nwbox.com/IEContentLoaded/
- top.doScroll("left");
- } catch(e) {
- return setTimeout( doScrollCheck, 50 );
- }
-
- // and execute any waiting functions
- jQuery.ready();
- }
- })();
- }
}
}
return readyList.promise( obj );