Skip to content

Commit

Permalink
Added an optimization for the case where $("body") is used.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeresig committed Sep 7, 2009
1 parent 50d78e7 commit b7d4e0e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/core.js
Expand Up @@ -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;
Expand Down

0 comments on commit b7d4e0e

Please sign in to comment.