From: John Resig Date: Wed, 22 Jul 2009 15:03:23 +0000 (+0000) Subject: Support dynamically loaded copies of jQuery using document ready. Fixes #4889. X-Git-Tag: 1.4a1~198 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=6fc57be843e2120ee6361af45b38d12a8c876f40;p=jquery.git Support dynamically loaded copies of jQuery using document ready. Fixes #4889. --- diff --git a/src/event.js b/src/event.js index 9c1f28734..8eaf44ef5 100644 --- a/src/event.js +++ b/src/event.js @@ -715,6 +715,12 @@ function bindReady() { if ( readyBound ) return; readyBound = true; + // Catch cases where $(document).ready() is called after the + // browser event has already occurred. + if ( document.readyState === "complete" ) { + return jQuery.ready(); + } + // Mozilla, Opera and webkit nightlies currently support this event if ( document.addEventListener ) { // Use the handy event callback