From: John Resig Date: Sat, 7 Nov 2009 15:00:43 +0000 (+0100) Subject: Make sure that document.body exists, at least, in IE before the ready event is fired... X-Git-Tag: 1.4a1~93 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=81bfd9b870f658ce00eec48ea48a84d69c20bf05;p=jquery.git Make sure that document.body exists, at least, in IE before the ready event is fired. Fixes #5443. --- diff --git a/src/event.js b/src/event.js index aabe77ead..f9c5fae01 100644 --- a/src/event.js +++ b/src/event.js @@ -822,7 +822,8 @@ function bindReady() { // ensure firing before onload, // maybe late but safe also for iframes document.attachEvent("onreadystatechange", function() { - if ( document.readyState === "complete" ) { + // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). + if ( document.readyState === "complete" && document.body ) { document.detachEvent( "onreadystatechange", arguments.callee ); jQuery.ready(); }