diff options
author | Dave Methvin <dave.methvin@gmail.com> | 2012-12-23 15:57:01 -0500 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2012-12-23 15:57:01 -0500 |
commit | 861a45b8fffc2073baa9f62b0648f395f0695f3e (patch) | |
tree | f2574f489712a07351b2821a21eda567efdda2b7 /src | |
parent | 5eec75e582d27e2d4f625f6be33eabad84f16239 (diff) | |
download | jquery-861a45b8fffc2073baa9f62b0648f395f0695f3e.tar.gz jquery-861a45b8fffc2073baa9f62b0648f395f0695f3e.zip |
Followup to gh-1089. Avoid duplicate typeof check.
Diffstat (limited to 'src')
-rw-r--r-- | src/core.js | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/core.js b/src/core.js index 3d5f4be3f..656fc22f1 100644 --- a/src/core.js +++ b/src/core.js @@ -96,13 +96,6 @@ jQuery.fn = jQuery.prototype = { return this; } - // HANDLE: $(DOMElement); check first that selector is not a primitive - if ( typeof selector === "object" && selector.nodeType ) { - this.context = this[0] = selector; - this.length = 1; - return this; - } - // Handle HTML strings if ( typeof selector === "string" ) { if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { @@ -176,6 +169,12 @@ jQuery.fn = jQuery.prototype = { return this.constructor( context ).find( selector ); } + // HANDLE: $(DOMElement) + } else if ( selector.nodeType ) { + this.context = this[0] = selector; + this.length = 1; + return this; + // HANDLE: $(function) // Shortcut for document ready } else if ( jQuery.isFunction( selector ) ) { |