Skip to content

Commit 861a45b

Browse files
committed
Followup to jquerygh-1089. Avoid duplicate typeof check.
1 parent 5eec75e commit 861a45b

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/core.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,6 @@ jQuery.fn = jQuery.prototype = {
9696
return this;
9797
}
9898

99-
// HANDLE: $(DOMElement); check first that selector is not a primitive
100-
if ( typeof selector === "object" && selector.nodeType ) {
101-
this.context = this[0] = selector;
102-
this.length = 1;
103-
return this;
104-
}
105-
10699
// Handle HTML strings
107100
if ( typeof selector === "string" ) {
108101
if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
@@ -176,6 +169,12 @@ jQuery.fn = jQuery.prototype = {
176169
return this.constructor( context ).find( selector );
177170
}
178171

172+
// HANDLE: $(DOMElement)
173+
} else if ( selector.nodeType ) {
174+
this.context = this[0] = selector;
175+
this.length = 1;
176+
return this;
177+
179178
// HANDLE: $(function)
180179
// Shortcut for document ready
181180
} else if ( jQuery.isFunction( selector ) ) {

0 commit comments

Comments
 (0)