]> source.dussan.org Git - jquery-ui.git/commitdiff
Effects: Delegate to core show/hide when the element is already in the correct final...
authorScott González <scott.gonzalez@gmail.com>
Tue, 26 Feb 2013 15:36:03 +0000 (10:36 -0500)
committerScott González <scott.gonzalez@gmail.com>
Tue, 26 Feb 2013 15:36:03 +0000 (10:36 -0500)
tests/unit/effects/effects.html
tests/unit/effects/effects_core.js
ui/jquery.ui.effect.js

index c283eabff235caedfa48c3b6fc2160f1dd0b102c..7ddacf7bb665a79da1a254b351f3a8eeb25054ff 100644 (file)
@@ -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>
index c9b1e1b4a8b5d721a1b9270eecc94d715045c6b5..928d4c15bb7574be18962dbf2ffe2664309eaab6 100644 (file)
@@ -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;
index 97f006ee06a81fbe155931df5aff6c1fc82e9f5d..41aeb4819ab983a5c1254857b8de5ccc0bcfabc0 100644 (file)
@@ -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 );