From 4ea4fad0902839c06c281b5de7b0aca29922b63d Mon Sep 17 00:00:00 2001 From: John Resig Date: Tue, 8 Sep 2009 04:26:47 +0000 Subject: [PATCH] Optimize jQuery() for the case $("TAG"). --- src/core.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core.js b/src/core.js index a7cbdc99..5fa944bc 100644 --- a/src/core.js +++ b/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 );