]> source.dussan.org Git - jquery.git/commitdiff
Add back unit in the width/height step function. Fixes #10669.
authortimmywil <timmywillisn@gmail.com>
Mon, 7 Nov 2011 15:46:46 +0000 (10:46 -0500)
committertimmywil <timmywillisn@gmail.com>
Mon, 7 Nov 2011 15:47:09 +0000 (10:47 -0500)
src/effects.js
test/unit/effects.js

index 523cd7d29da063f5e8c7d61f0a558a0e1b623ea8..808635d012954347cbfaf8594e5ed5ce7a5c9709 100644 (file)
@@ -620,7 +620,7 @@ jQuery.extend( jQuery.fx, {
 // Do not set anything below 0
 jQuery.each([ "width", "height" ], function( i, prop ) {
        jQuery.fx.step[ prop ] = function( fx ) {
-               jQuery.style( fx.elem, prop, Math.max(0, fx.now) );
+               jQuery.style( fx.elem, prop, Math.max(0, fx.now) + fx.unit );
        };
 });
 
index 36335c43f6eed821bcac86c178dba145cfe0b7c3..82067cb8b447d583de598d6e235065ac680ddc5c 100644 (file)
@@ -324,6 +324,21 @@ test("animate table-cell width/height", function() {
        });
 });
 
+test("animate percentage(%) on width/height", function() {
+       expect( 2 );
+
+       var $div = jQuery("<div style='position:absolute;top:-999px;left:-999px;width:60px;height:60px;'><div style='width:50%;height:50%;'></div></div>")
+               .appendTo("#qunit-fixture").children("div");
+
+       stop();
+       $div.animate({ width: "25%", height: "25%" }, 13, function() {
+               var $this = jQuery(this);
+               equal( $this.width(), 15, "Width was animated to 15px rather than 25px");
+               equal( $this.height(), 15, "Height was animated to 15px rather than 25px");
+               start();
+       });
+});
+
 test("animate resets overflow-x and overflow-y when finished", function() {
        expect(2);
        stop();