diff options
author | Scott González <scott.gonzalez@gmail.com> | 2013-02-26 10:36:03 -0500 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2013-02-26 10:36:03 -0500 |
commit | 948563b8b55802c6d4c513065f1b78bbdcff104c (patch) | |
tree | 2153fb0270b0626c25ddd2f23cf4ea0776317710 | |
parent | d0ad572349beadc99810ecd53a532bf5f261343d (diff) | |
download | jquery-ui-948563b8b55802c6d4c513065f1b78bbdcff104c.tar.gz jquery-ui-948563b8b55802c6d4c513065f1b78bbdcff104c.zip |
Effects: Delegate to core show/hide when the element is already in the correct final state. This forces the element to go through the olddisplay tracking and forces styles on elements even if they're hidden via an ancestor. Fixes #9120 - Effects: .hide() inconsistent with core with a hidden parent.
-rw-r--r-- | tests/unit/effects/effects.html | 4 | ||||
-rw-r--r-- | tests/unit/effects/effects_core.js | 8 | ||||
-rw-r--r-- | ui/jquery.ui.effect.js | 5 |
3 files changed, 14 insertions, 3 deletions
diff --git a/tests/unit/effects/effects.html b/tests/unit/effects/effects.html index c283eabff..7ddacf7bb 100644 --- a/tests/unit/effects/effects.html +++ b/tests/unit/effects/effects.html @@ -96,7 +96,9 @@ <h2 id="qunit-userAgent"></h2> <ol id="qunit-tests"></ol> <div id="qunit-fixture"> -<div class="hidden test"></div> +<div class="hidden test"> + <div>.</div> +</div> <div class="animateClass test"> <h2>Child Element Test</h2> </div> diff --git a/tests/unit/effects/effects_core.js b/tests/unit/effects/effects_core.js index c9b1e1b4a..928d4c15b 100644 --- a/tests/unit/effects/effects_core.js +++ b/tests/unit/effects/effects_core.js @@ -28,6 +28,14 @@ test( "Immediate Return Conditions", function() { equal( ++count, 3, "Both Functions worked properly" ); }); +test( ".hide() with hidden parent", function() { + expect( 1 ); + var element = $( "div.hidden" ).children(); + element.hide( "blind", function() { + equal( element.css( "display" ), "none", "display: none" ); + }); +}); + asyncTest( "Parse of null for options", function() { var hidden = $( "div.hidden" ), count = 0; diff --git a/ui/jquery.ui.effect.js b/ui/jquery.ui.effect.js index 97f006ee0..41aeb4819 100644 --- a/ui/jquery.ui.effect.js +++ b/ui/jquery.ui.effect.js @@ -1150,9 +1150,10 @@ $.fn.extend({ } } - // if the element is hiddden and mode is hide, - // or element is visible and mode is show + // If the element already has the correct final state, delegate to + // the core methods so the internal tracking of "olddisplay" works. if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) { + elem[ mode ](); done(); } else { effectMethod.call( elem[0], args, done ); |