Skip to content
Permalink
Browse files

Followup to gh-1089. Avoid duplicate typeof check.

  • Loading branch information
dmethvin committed Dec 23, 2012
1 parent 5eec75e commit 861a45b8fffc2073baa9f62b0648f395f0695f3e
Showing with 6 additions and 7 deletions.
  1. +6 −7 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 ) ) {

0 comments on commit 861a45b

Please sign in to comment.
You can’t perform that action at this time.