]> source.dussan.org Git - jquery.git/commitdiff
jquery core: closes #2811, $.fn.add now calls $.unique internally, also it was failin...
authorAriel Flesler <aflesler@gmail.com>
Thu, 8 May 2008 17:08:59 +0000 (17:08 +0000)
committerAriel Flesler <aflesler@gmail.com>
Thu, 8 May 2008 17:08:59 +0000 (17:08 +0000)
src/core.js

index 42fd8d499be454b34b3b5791ced7b08b7d4fd311..a6d4c5f74b2a8ee97bbd51fb3ccf11d6278a1737 100644 (file)
@@ -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 ) {