From: Sebi Burkhard Date: Tue, 18 Dec 2012 17:20:56 +0000 (+0700) Subject: Fix #13076. Speed up $() with strings, part of gh-1089. X-Git-Tag: 1.9.0rc1~14 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d8298046311e66a47424ec3f3cbe77e97bee3958;p=jquery.git Fix #13076. Speed up $() with strings, part of gh-1089. --- diff --git a/AUTHORS.txt b/AUTHORS.txt index 639ed4b64..62df6f5a5 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -156,4 +156,4 @@ Matthias Jäggli Yiming He Devin Cooper Bennett Sorbo - \ No newline at end of file +Sebastian Burkhard diff --git a/src/core.js b/src/core.js index 844eb1593..5927d1936 100644 --- a/src/core.js +++ b/src/core.js @@ -96,8 +96,8 @@ jQuery.fn = jQuery.prototype = { return this; } - // HANDLE: $(DOMElement) - if ( selector.nodeType ) { + // 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;