]> source.dussan.org Git - jquery.git/commitdiff
Optimize jQuery() for the case $("TAG").
authorJohn Resig <jeresig@gmail.com>
Tue, 8 Sep 2009 04:26:47 +0000 (04:26 +0000)
committerJohn Resig <jeresig@gmail.com>
Tue, 8 Sep 2009 04:26:47 +0000 (04:26 +0000)
src/core.js

index a7cbdc99cc69fd2650993ed21e4011c30c909f0d..5fa944bc307f1472ab417afac3111fb05dcef5b8 100644 (file)
@@ -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 );