diff --git a/src/css.js b/src/css.js index 2a7172759..e2dcb5018 100644 --- a/src/css.js +++ b/src/css.js @@ -263,7 +263,7 @@ jQuery.extend({ } // Return, converting to number if forced or a qualifier was provided and val looks numeric - if ( extra ) { + if ( extra === "" || extra ) { num = parseFloat( val ); return extra === true || jQuery.isNumeric( num ) ? num || 0 : val; } diff --git a/src/effects.js b/src/effects.js index 1eee0a991..e1c11dca5 100644 --- a/src/effects.js +++ b/src/effects.js @@ -418,11 +418,11 @@ Tween.propHooks = { return tween.elem[ tween.prop ]; } - // passing a non empty string as a 3rd parameter to .css will automatically + // passing an empty string as a 3rd parameter to .css will automatically // attempt a parseFloat and fallback to a string if the parse fails // so, simple values such as "10px" are parsed to Float. // complex values such as "rotate(1rad)" are returned as is. - result = jQuery.css( tween.elem, tween.prop, "auto" ); + result = jQuery.css( tween.elem, tween.prop, "" ); // Empty strings, null, undefined and "auto" are converted to 0. return !result || result === "auto" ? 0 : result; }, diff --git a/test/unit/effects.js b/test/unit/effects.js index 16b4c15e5..3f986097e 100644 --- a/test/unit/effects.js +++ b/test/unit/effects.js @@ -257,14 +257,31 @@ test("animate native inline width/height", function() { }); }); -test("animate block width/height", function() { - expect(3); +test( "animate block width/height", function() { + expect( 3 ); stop(); - jQuery("#foo").css({ display: "block", width: 20, height: 20 }).animate({ width: 42, height: 42 }, 100, function() { - equal( jQuery(this).css("display"), "block", "inline-block was not set on block element when animating width/height" ); - equal( this.offsetWidth, 42, "width was animated" ); - equal( this.offsetHeight, 42, "height was animated" ); - start(); + + jQuery("