Allow data to be bound to Flash objects (but still stopping short of attaching to...
[jquery.git] / src / core.js
index 158f479..cc92138 100644 (file)
@@ -91,7 +91,7 @@ jQuery.fn = jQuery.prototype = {
                }
                
                // The body element only exists once, optimize finding it
-               if ( selector === "body" && !context ) {
+               if ( selector === "body" && !context && document.body ) {
                        this.context = document;
                        this[0] = document.body;
                        this.selector = "body";
@@ -397,7 +397,7 @@ jQuery.extend({
                if ( !jQuery.readyWait || (wait !== true && !jQuery.isReady) ) {
                        // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
                        if ( !document.body ) {
-                               return setTimeout( jQuery.ready, 13 );
+                               return setTimeout( jQuery.ready, 1 );
                        }
 
                        // Remember that the DOM is ready
@@ -437,7 +437,8 @@ jQuery.extend({
                // Catch cases where $(document).ready() is called after the
                // browser event has already occurred.
                if ( document.readyState === "complete" ) {
-                       return jQuery.ready();
+                       // Handle it asynchronously to allow scripts the opportunity to delay ready
+                       return setTimeout( jQuery.ready, 1 );
                }
 
                // Mozilla, Opera and webkit nightlies currently support this event