Make sure that width or height don't animate to a negative value. Fixes #3881.
This commit is contained in:
parent
8d1efee316
commit
b24da33f52
|
@ -432,7 +432,7 @@ jQuery.extend( jQuery.fx, {
|
||||||
|
|
||||||
_default: function(fx){
|
_default: function(fx){
|
||||||
if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) {
|
if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) {
|
||||||
fx.elem.style[ fx.prop ] = fx.now + fx.unit;
|
fx.elem.style[ fx.prop ] = (fx.prop === "width" || fx.prop === "height" ? Math.max(0, fx.now) : fx.now) + fx.unit;
|
||||||
} else {
|
} else {
|
||||||
fx.elem[ fx.prop ] = fx.now;
|
fx.elem[ fx.prop ] = fx.now;
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,15 @@ test("animate(Hash, Object, Function)", function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("animate negative height", function() {
|
||||||
|
expect(1);
|
||||||
|
stop();
|
||||||
|
jQuery("#foo").animate({ height: -100 }, 100, function() {
|
||||||
|
equals( this.offsetHeight, 0, "Verify height." );
|
||||||
|
start();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
/* // This test ends up being flaky depending upon the CPU load
|
/* // This test ends up being flaky depending upon the CPU load
|
||||||
test("animate option (queue === false)", function () {
|
test("animate option (queue === false)", function () {
|
||||||
expect(1);
|
expect(1);
|
||||||
|
|
Loading…
Reference in a new issue