aboutsummaryrefslogtreecommitdiffstats
path: root/src/core.js
diff options
context:
space:
mode:
authorJohn Resig <jeresig@gmail.com>2009-09-07 17:20:38 +0000
committerJohn Resig <jeresig@gmail.com>2009-09-07 17:20:38 +0000
commitb7d4e0e46cb2cad6f400173cd09ce44d1b8ad04e (patch)
treeae2efc1a54b6185b840e38de25a1de75f906aec5 /src/core.js
parent50d78e7658382d2a2f5149cae7a6572f78ce403f (diff)
downloadjquery-b7d4e0e46cb2cad6f400173cd09ce44d1b8ad04e.tar.gz
jquery-b7d4e0e46cb2cad6f400173cd09ce44d1b8ad04e.zip
Added an optimization for the case where $("body") is used.
Diffstat (limited to 'src/core.js')
-rw-r--r--src/core.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/core.js b/src/core.js
index c8b5a46da..5ccf15875 100644
--- a/src/core.js
+++ b/src/core.js
@@ -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;