X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fjquery%2Fjquery.js;h=38253c1f59148af1f0cf3455fa061dca9aa8e8c2;hb=6c072457ed36464f7f2bc15128e69206dbac5d24;hp=67959697bf2472e131697a4dcc280ec878cc1af0;hpb=756183f6073a1e9fe6fae538d6f60899df47e2a1;p=jquery.git diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js index 6795969..38253c1 100644 --- a/src/jquery/jquery.js +++ b/src/jquery/jquery.js @@ -32,8 +32,7 @@ var jQuery = function(a,c) { // HANDLE: $(function) // Shortcut for document ready - // Safari reports typeof on DOM NodeLists as a function - if ( jQuery.isFunction(a) && !a.nodeType && a[0] == undefined ) + if ( jQuery.isFunction(a) ) return new jQuery(document)[ jQuery.fn.ready ? "ready" : "load" ]( a ); // Handle HTML strings @@ -429,7 +428,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 +984,10 @@ jQuery.fn = jQuery.prototype = { add: function(t) { return this.pushStack( jQuery.merge( this.get(), - typeof t == "string" ? jQuery(t).get() : t.length ? t : [t] ) + t.constructor == String ? + jQuery(t).get() : + t.length != undefined && !t.nodeName ? + t : [t] ) ); }, @@ -1219,8 +1221,11 @@ jQuery.extend({ $ = 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 + "" ); }, /** @@ -1268,7 +1273,7 @@ jQuery.extend({ return value.call( elem, [index] ); // exclude the following css properties to add px - var exclude = /z-?index|font-?weight|opacity|zoom/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) )