Added an optimization for the case where $("body") is used.
[jquery.git] / src / core.js
index c8b5a46..5ccf158 100644 (file)
@@ -48,6 +48,11 @@ jQuery.fn = jQuery.prototype = {
                        return this;
                }
 
+               // $("body"): Shortcut for quickly finding the body element
+               if ( selector === "body" && !context && document.body ) {
+                       selector = document.body;
+               }
+
                // Handle $(DOMElement)
                if ( selector.nodeType ) {
                        this.context = this[0] = selector;