]> source.dussan.org Git - jquery.git/commitdiff
Fix the logic to set overflow:hidden on width & height animations - Fixes #12117...
authorCorey Frang <gnarf@gnarf.net>
Fri, 20 Jul 2012 23:36:55 +0000 (18:36 -0500)
committerCorey Frang <gnarf@gnarf.net>
Fri, 20 Jul 2012 23:36:55 +0000 (18:36 -0500)
src/effects.js
test/unit/effects.js

index f28ef9418d1f1792050449858917da90a5a5d70d..22e79f1bafb11f76fb62361edf93af46adb5d317 100644 (file)
@@ -269,7 +269,7 @@ function defaultPrefilter( elem, props, opts ) {
        }
 
        // height/width overflow pass
-       if ( elem.nodeType === 1 && ( props.height || props.width ) ) {
+       if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
                // Make sure that nothing sneaks out
                // Record all 3 overflow attributes because IE does not
                // change the overflow attribute when overflowX and
index fc9c9cc7b590db984cb5fe04ef3badf2ddfdc746..17ba1c21abb42d05b62555813983f40d02f95159 100644 (file)
@@ -1785,4 +1785,18 @@ asyncTest("Animation callbacks (#11797)", 15, function() {
        });
 });
 
+test( "Animate properly sets overflow hidden when animating width/height (#12117)", 4, function() {
+       jQuery.each( [ "height", "width" ], function( _, prop ) {
+               jQuery.each( [ 100, 0 ], function( _, value ) {
+                       var div = jQuery("<div>"),
+                               props = {};
+                       props[ prop ] = value;
+                       div.animate( props, 1 );
+                       equal( div.css( "overflow" ), "hidden",
+                               "overflow: hidden set when animating " + prop + " to " + value );
+                       div.stop();
+               });
+       });
+});
+
 } // if ( jQuery.fx )