Skip to content
Permalink
Browse files

Optimize jQuery() for the case $("TAG").

  • Loading branch information
jeresig committed Sep 8, 2009
1 parent 1e750a0 commit 4ea4fad0902839c06c281b5de7b0aca29922b63d
Showing with 4 additions and 0 deletions.
  1. +4 −0 src/core.js
@@ -109,6 +109,10 @@ jQuery.fn = jQuery.prototype = {
return this;
}

// HANDLE: $("TAG")
} else if ( !context && /^\w+$/.test( selector ) ) {
selector = document.getElementsByTagName( selector );

// HANDLE: $(expr, $(...))
} else if ( !context || context.jquery ) {
return (context || rootjQuery).find( selector );

0 comments on commit 4ea4fad

Please sign in to comment.
You can’t perform that action at this time.