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

This commit is contained in:
John Resig 2009-09-08 04:26:47 +00:00
parent 1e750a00e9
commit 4ea4fad090

View file

@ -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 );