From: Dave Methvin Date: Sun, 27 Jan 2013 03:02:15 +0000 (-0500) Subject: Fix #12846. Restore overflow when animation is stopped. X-Git-Tag: 1.9.1~19 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3f9f2b1dbcefdafc5ef11f7deb222a3b6d8941d8;p=jquery.git Fix #12846. Restore overflow when animation is stopped. (Cherry picked from a6c358d) --- diff --git a/src/effects.js b/src/effects.js index 189f65ce5..ce7017ef1 100644 --- a/src/effects.js +++ b/src/effects.js @@ -303,7 +303,7 @@ function defaultPrefilter( elem, props, opts ) { if ( opts.overflow ) { style.overflow = "hidden"; if ( !jQuery.support.shrinkWrapBlocks ) { - anim.done(function() { + anim.always(function() { style.overflow = opts.overflow[ 0 ]; style.overflowX = opts.overflow[ 1 ]; style.overflowY = opts.overflow[ 2 ]; diff --git a/test/unit/effects.js b/test/unit/effects.js index aa061058b..173af5a0e 100644 --- a/test/unit/effects.js +++ b/test/unit/effects.js @@ -1787,16 +1787,18 @@ asyncTest("Animation callbacks (#11797)", 15, function() { }); }); -test( "Animate properly sets overflow hidden when animating width/height (#12117)", 4, function() { +test( "Animate properly sets overflow hidden when animating width/height (#12117)", 8, function() { jQuery.each( [ "height", "width" ], function( _, prop ) { jQuery.each( [ 100, 0 ], function( _, value ) { - var div = jQuery("
"), + var div = jQuery("
").css( "overflow", "auto" ), props = {}; props[ prop ] = value; div.animate( props, 1 ); equal( div.css( "overflow" ), "hidden", "overflow: hidden set when animating " + prop + " to " + value ); div.stop(); + equal( div.css( "overflow" ), "auto", + "overflow: auto restored after animating " + prop + " to " + value ); }); }); });