Removed some extra code that ifFunction deprecated.
[jquery.git] / src / jquery / jquery.js
index 6795969..38253c1 100644 (file)
@@ -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) )