X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fjquery%2Fjquery.js;h=38c8da303d8d980db5fc78405798bed43cdbb3c5;hb=7b3ab69fcfd5a53d7084bbe4b19a7f3e58d8564d;hp=4cc2a68fe5baf90d4bb4b79d3b93364e12142ca3;hpb=2d32400e3c7d226ef6d93fd91654768959695e80;p=jquery.git diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js index 4cc2a68..38c8da3 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( @@ -429,7 +429,7 @@ jQuery.fn = jQuery.prototype = { // Look for the case where we're accessing a style value if ( key.constructor == String ) if ( value == undefined ) - return jQuery[ type || "attr" ]( this[0], key ); + return this.length && jQuery[ type || "attr" ]( this[0], key ) || undefined; else { obj = {}; obj[ key ] = value; @@ -985,7 +985,10 @@ jQuery.fn = jQuery.prototype = { add: function(t) { return this.pushStack( jQuery.merge( this.get(), - typeof t == "string" ? jQuery(t).get() : t ) + t.constructor == String ? + jQuery(t).get() : + t.length != undefined && !t.nodeName ? + t : [t] ) ); }, @@ -1268,7 +1271,7 @@ jQuery.extend({ return value.call( elem, [index] ); // exclude the following css properties to add px - var exclude = /z-?index|font-?weight|opacity/i; + var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i; // Handle passing in a number to a CSS property if ( value.constructor == Number && type == "curCSS" && !exclude.test(prop) ) @@ -1571,7 +1574,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) {