jQuery: The Write Less, Do More JavaScript Library

Changeset 5503

Show
Ignore:
Timestamp:
05/08/08 17:08:59 (5 days ago)
Author:
aflesler
Message:

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

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/jquery/src/core.js

    r5500 r5503  
    338338 
    339339    add: function( selector ) { 
    340         return !selector ? this : this.pushStack( jQuery.merge(  
     340        return this.pushStack( jQuery.unique( jQuery.merge(  
    341341            this.get(), 
    342             selector.constructor == String ?  
    343                 jQuery( selector ).get() : 
    344                 selector.length != undefined && (!selector.nodeName || jQuery.nodeName(selector, "form")) ? 
    345                     selector : [selector] ) ); 
     342            typeof selector == 'string' ?  
     343                jQuery( selector ) : 
     344                jQuery.makeArray( selector ) 
     345        ))); 
    346346    }, 
    347347