From: Ariel Flesler Date: Thu, 8 May 2008 17:08:59 +0000 (+0000) Subject: jquery core: closes #2811, $.fn.add now calls $.unique internally, also it was failin... X-Git-Tag: 1.2.4b~19 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=487567e82fed4f596b5f97bfbcd5c2429ca35bb0;p=jquery.git jquery core: closes #2811, $.fn.add now calls $.unique internally, also it was failing for array-like f.e: window. --- diff --git a/src/core.js b/src/core.js index 42fd8d499..a6d4c5f74 100644 --- a/src/core.js +++ b/src/core.js @@ -337,12 +337,12 @@ jQuery.fn = jQuery.prototype = { }, add: function( selector ) { - return !selector ? this : this.pushStack( jQuery.merge( + return this.pushStack( jQuery.unique( jQuery.merge( this.get(), - selector.constructor == String ? - jQuery( selector ).get() : - selector.length != undefined && (!selector.nodeName || jQuery.nodeName(selector, "form")) ? - selector : [selector] ) ); + typeof selector == 'string' ? + jQuery( selector ) : + jQuery.makeArray( selector ) + ))); }, is: function( selector ) {