aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTimo Tijhof <krinklemail@gmail.com>2013-12-14 02:10:46 +0100
committerRichard Gibson <richard.gibson@gmail.com>2013-12-30 12:36:31 -0500
commit1828c9856e54b7d5ead7b374b247f8432f96c278 (patch)
tree93c28c1dac3d20218a98a3236ae34ac339cc0bab /src
parent7468461569fa2908aa84f162b3ad7cfda42b46bf (diff)
downloadjquery-1828c9856e54b7d5ead7b374b247f8432f96c278.tar.gz
jquery-1828c9856e54b7d5ead7b374b247f8432f96c278.zip
traversing: Optimise .add by not using makeArray
(cherry picked from commit b39ee05b69336d5a6230287ab8bd48c48e5b206f) Closes gh-1430
Diffstat (limited to 'src')
-rw-r--r--src/traversing.js11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/traversing.js b/src/traversing.js
index 5dd970f67..ee3676963 100644
--- a/src/traversing.js
+++ b/src/traversing.js
@@ -106,12 +106,11 @@ jQuery.fn.extend({
},
add: function( selector, context ) {
- var set = typeof selector === "string" ?
- jQuery( selector, context ) :
- jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
- all = jQuery.merge( this.get(), set );
-
- return this.pushStack( jQuery.unique(all) );
+ return this.pushStack(
+ jQuery.unique(
+ jQuery.merge( this.get(), jQuery( selector, context ) )
+ )
+ );
},
addBack: function( selector ) {