Skip to content

Commit

Permalink
Optimize jQuery() for the case $("TAG").
Browse files Browse the repository at this point in the history
  • Loading branch information
jeresig committed Sep 8, 2009
1 parent 1e750a0 commit 4ea4fad
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/core.js
Expand Up @@ -109,6 +109,10 @@ jQuery.fn = jQuery.prototype = {
return this; return this;
} }


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

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

0 comments on commit 4ea4fad

Please sign in to comment.