Skip to content
Permalink
Browse files

Effects: Delegate to core show/hide when the element is already in th…

…e 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.
  • Loading branch information
scottgonzalez committed Feb 26, 2013
1 parent d0ad572 commit 948563b8b55802c6d4c513065f1b78bbdcff104c
Showing with 14 additions and 3 deletions.
  1. +3 −1 tests/unit/effects/effects.html
  2. +8 −0 tests/unit/effects/effects_core.js
  3. +3 −2 ui/jquery.ui.effect.js
@@ -96,7 +96,9 @@ <h2 id="qunit-banner"></h2>
<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>
@@ -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;
@@ -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 );

0 comments on commit 948563b

Please sign in to comment.
You can’t perform that action at this time.