jquery core: closes #2811, $.fn.add now calls $.unique internally, also it was failing for array-like f.e: window.

This commit is contained in:
Ariel Flesler 2008-05-08 17:08:59 +00:00
parent 407c5eb430
commit 487567e82f

View 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 ) {