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-Url: http://git.asbjorn.biz/?p=jquery.git;a=commitdiff_plain;h=487567e82fed4f596b5f97bfbcd5c2429ca35bb0 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 42fd8d4..a6d4c5f 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 ) {