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 ) { add: function( selector ) {
return !selector ? this : this.pushStack( jQuery.merge( return this.pushStack( jQuery.unique( jQuery.merge(
this.get(), this.get(),
selector.constructor == String ? typeof selector == 'string' ?
jQuery( selector ).get() : jQuery( selector ) :
selector.length != undefined && (!selector.nodeName || jQuery.nodeName(selector, "form")) ? jQuery.makeArray( selector )
selector : [selector] ) ); )));
}, },
is: function( selector ) { is: function( selector ) {