X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjquery%2Fjquery.js;h=f756b67ab78e08f54831061b9e2c51fd20793082;hb=3362ccf3ddc20d787551ffdb441ae606a3d06630;hp=4cc2a68fe5baf90d4bb4b79d3b93364e12142ca3;hpb=2d32400e3c7d226ef6d93fd91654768959695e80;p=jquery.git diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js index 4cc2a68..f756b67 100644 --- a/src/jquery/jquery.js +++ b/src/jquery/jquery.js @@ -38,14 +38,14 @@ var jQuery = function(a,c) { // 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( @@ -985,7 +985,7 @@ jQuery.fn = jQuery.prototype = { 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] ) ); }, @@ -1571,7 +1571,7 @@ jQuery.extend({ * @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) {