From 262fcf7b7b919da1564509f621cf7480a5d5572b Mon Sep 17 00:00:00 2001 From: John Resig Date: Mon, 9 Nov 2009 13:47:53 +0100 Subject: [PATCH] Require that, at least, document.body exists before firing the ready event. This may stop jQuery from working on pages that don't create a document.body (such as Safari, when no body exists) but considering that we've required a document.body since 1.3 and haven't broken any pages, this doesn't appear to be a pressing issue. Used the test case written by dmethvin to verify the bug and the fix. Fixes #4320. --- src/event.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/event.js b/src/event.js index 1b4c539..7cfb535 100644 --- a/src/event.js +++ b/src/event.js @@ -791,6 +791,10 @@ jQuery.extend({ ready: function() { // Make sure that the DOM is not already loaded if ( !jQuery.isReady ) { + if ( !document.body ) { + return setTimeout( jQuery.ready, 13 ); + } + // Remember that the DOM is ready jQuery.isReady = true; -- 1.7.10.4