Fixes #7912. Make sure .cur() only returns 0 as fallback value when it needs to ...
[jquery.git] / src / effects.js
index fd832ce..d9e9a8b 100644 (file)
@@ -185,7 +185,7 @@ jQuery.fn.extend({
 
                                } else {
                                        var parts = rfxnum.exec(val),
-                                               start = e.cur() || 0;
+                                               start = e.cur();
 
                                        if ( parts ) {
                                                var end = parseFloat( parts[2] ),
@@ -336,8 +336,12 @@ jQuery.fx.prototype = {
                        return this.elem[ this.prop ];
                }
 
-               var r = parseFloat( jQuery.css( this.elem, this.prop ) );
-               return r || 0;
+               var parsed,
+                       r = jQuery.css( this.elem, this.prop );
+               // Empty strings, null, undefined and "auto" are converted to 0,
+               // complex values such as "rotate(1rad)" are returned as is,
+               // simple values such as "10px" are parsed to Float.
+               return isNaN( parsed = parseFloat( r ) ) ? !r || r === "auto" ? 0 : r : parsed;
        },
 
        // Start an animation from one number to another