// Handle HTML strings
if ( typeof a == "string" ) {
+ // HANDLE: $(html) -> $(array)
var m = /^[^<]*(<.+>)[^>]*$/.exec(a);
-
- a = m ?
- // HANDLE: $(html) -> $(array)
- jQuery.clean( [ m[1] ] ) :
+ if ( m )
+ a = jQuery.clean( [ m[1] ] );
- // HANDLE: $(expr)
- jQuery.find( a, c );
+ // HANDLE: $(expr)
+ else
+ return new jQuery( c ).find( a );
}
return this.setArray(
add: function(t) {
return this.pushStack( jQuery.merge(
this.get(),
- typeof t == "string" ? jQuery(t).get() : t )
+ typeof t == "string" ? jQuery(t).get() : t.length ? t : [t] )
);
},
* @name $.merge
* @type Array
* @param Array first The first array to merge, the unique elements of second added.
- * @param Array second The second array to merge into the first, unalterd.
+ * @param Array second The second array to merge into the first, unaltered.
* @cat JavaScript
*/
merge: function(first, second) {