Commit 3b1cf91f authored by John Resig's avatar John Resig

Landed the patch, by Diego, that 1) Removes browser sniffing from the ready...

Landed the patch, by Diego, that 1) Removes browser sniffing from the ready code and 2) Provides some form of fallback DOM Ready for Iframes in IE. Closes #2614.
parent 5c21e44f
...@@ -526,21 +526,33 @@ function bindReady(){ ...@@ -526,21 +526,33 @@ function bindReady(){
// Use the handy event callback // Use the handy event callback
document.addEventListener( "DOMContentLoaded", jQuery.ready, false ); document.addEventListener( "DOMContentLoaded", jQuery.ready, false );
// If IE is used and is not in a frame // If IE event model is used
// Continually check to see if the document is ready if ( document.attachEvent )
if ( jQuery.browser.msie && window == top ) (function(){ // ensure firing before onload,
if (jQuery.isReady) return; // maybe late but safe also for iframes
try { document.attachEvent("onreadystatechange", function(e) {
// If IE is used, use the trick by Diego Perini if ( document.readyState == "complete" ) {
// http://javascript.nwbox.com/IEContentLoaded/ document.detachEvent("onreadystatechange", arguments.callee );
document.documentElement.doScroll("left"); jQuery.ready();
} catch( error ) { }
setTimeout( arguments.callee, 0 ); });
return;
} // If IE and not an iframe
// and execute any waiting functions if ( document.documentElement.doScroll && !window.frameElement )
jQuery.ready(); // continually check to see if the document is ready
})(); (function(){
if (jQuery.isReady) return;
try {
// If IE is used, use the trick by Diego Perini
// http://javascript.nwbox.com/IEContentLoaded/
document.documentElement.doScroll("left");
} catch( error ) {
setTimeout( arguments.callee, 0 );
return;
}
// and execute any waiting functions
jQuery.ready();
})();
if ( jQuery.browser.opera ) if ( jQuery.browser.opera )
document.addEventListener( "DOMContentLoaded", function () { document.addEventListener( "DOMContentLoaded", function () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment