🌐 AI搜索 & 代理 主页
Skip to content

Commit 4ea4fad

Browse files
committed
Optimize jQuery() for the case $("TAG").
1 parent 1e750a0 commit 4ea4fad

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/core.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ jQuery.fn = jQuery.prototype = {
109109
return this;
110110
}
111111

112+
// HANDLE: $("TAG")
113+
} else if ( !context && /^\w+$/.test( selector ) ) {
114+
selector = document.getElementsByTagName( selector );
115+
112116
// HANDLE: $(expr, $(...))
113117
} else if ( !context || context.jquery ) {
114118
return (context || rootjQuery).find( selector );

0 commit comments

Comments
 (0)