// 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;
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] )
);
},
$ = jQuery._$;
},
+ // This may seem like some crazy code, but trust me when I say that this
+ // is the only cross-browser way to do this. --John
isFunction: function( fn ) {
- return fn && typeof fn == "function";
+ return !!fn && typeof fn != "string" &&
+ typeof fn[0] == "undefined" && /function/i.test( fn + "" );
},
/**
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) )