Permalink
Browse files

jquery core: closes #2811, $.fn.add now calls $.unique internally, al…

…so it was failing for array-like f.e: window.
  • Loading branch information...
1 parent 407c5eb commit 487567e82fed4f596b5f97bfbcd5c2429ca35bb0 @flesler flesler committed May 8, 2008
Showing with 5 additions and 5 deletions.
  1. +5 −5 src/core.js
View
@@ -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 ) {

0 comments on commit 487567e

Please sign in to comment.