]> source.dussan.org Git - jquery.git/commitdiff
Followup to gh-1089. Avoid duplicate typeof check.
authorDave Methvin <dave.methvin@gmail.com>
Sun, 23 Dec 2012 20:57:01 +0000 (15:57 -0500)
committerDave Methvin <dave.methvin@gmail.com>
Sun, 23 Dec 2012 20:57:01 +0000 (15:57 -0500)
src/core.js

index 3d5f4be3f54d67752f7a6ce14cf0f1068236bf2b..656fc22f149c0a50bfe03d2160944565e5f3e71d 100644 (file)
@@ -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 ) ) {