From b7d4e0e46cb2cad6f400173cd09ce44d1b8ad04e Mon Sep 17 00:00:00 2001 From: John Resig Date: Mon, 7 Sep 2009 17:20:38 +0000 Subject: [PATCH] Added an optimization for the case where $("body") is used. --- src/core.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core.js b/src/core.js index c8b5a46daa..5ccf15875c 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;