diff options
author | Timo Tijhof <krinklemail@gmail.com> | 2013-12-14 02:10:46 +0100 |
---|---|---|
committer | Richard Gibson <richard.gibson@gmail.com> | 2013-12-30 12:34:08 -0500 |
commit | b39ee05b69336d5a6230287ab8bd48c48e5b206f (patch) | |
tree | 3048eac1058432da77c7584a712c48ed812c07e0 /src | |
parent | 537e9ced6164074c32df429bb1fa4c30361aa711 (diff) | |
download | jquery-b39ee05b69336d5a6230287ab8bd48c48e5b206f.tar.gz jquery-b39ee05b69336d5a6230287ab8bd48c48e5b206f.zip |
traversing: Optimise .add by not using makeArray
Closes gh-1430
Diffstat (limited to 'src')
-rw-r--r-- | src/traversing.js | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/traversing.js b/src/traversing.js index e3fc5cfa2..943d16cb6 100644 --- a/src/traversing.js +++ b/src/traversing.js @@ -111,12 +111,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 ) { |