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

Commit fd2a2fe

Browse files
committed
Optimized jQuery(Element) to not call jQuery() twice.
1 parent bbf3334 commit fd2a2fe

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/core.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,13 @@ jQuery.fn = jQuery.prototype = {
7272
}
7373

7474
// Otherwise, we inject the element directly into the jQuery object
75-
ret = jQuery( elem || null );
76-
ret.context = document;
77-
ret.selector = selector;
78-
return ret;
75+
this.length = elem ? 1 : 0;
76+
if ( elem ) {
77+
this[0] = elem;
78+
}
79+
this.context = document;
80+
this.selector = selector;
81+
return this;
7982
}
8083

8184
// HANDLE: $(expr, $(...))

0 commit comments

Comments
 (0)