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.

This commit is contained in:
John Resig 2008-11-12 13:18:47 +00:00
parent 5c21e44fce
commit 3b1cf91fa4

View file

@ -526,9 +526,21 @@ 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,
// maybe late but safe also for iframes
document.attachEvent("onreadystatechange", function(e) {
if ( document.readyState == "complete" ) {
document.detachEvent("onreadystatechange", arguments.callee );
jQuery.ready();
}
});
// If IE and not an iframe
if ( document.documentElement.doScroll && !window.frameElement )
// continually check to see if the document is ready
(function(){
if (jQuery.isReady) return; if (jQuery.isReady) return;
try { try {
// If IE is used, use the trick by Diego Perini // If IE is used, use the trick by Diego Perini