From 6fc57be843e2120ee6361af45b38d12a8c876f40 Mon Sep 17 00:00:00 2001 From: John Resig Date: Wed, 22 Jul 2009 15:03:23 +0000 Subject: [PATCH] Support dynamically loaded copies of jQuery using document ready. Fixes #4889. --- src/event.js | 6 ++++++ 1 file changed, 6 insertions(+) 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