diff options
author | jeresig <jeresig@gmail.com> | 2010-10-27 14:35:26 -0400 |
---|---|---|
committer | jeresig <jeresig@gmail.com> | 2010-10-27 14:35:26 -0400 |
commit | 6e7a4e73a2d821fd2a7b71e080b9284909af1596 (patch) | |
tree | 19ffdc4781d67787f3b8ee7134d85eb4890abaa0 | |
parent | 6ab402dced3339d24ad007ecf3a6c3f5af3e7610 (diff) | |
download | jquery-6e7a4e73a2d821fd2a7b71e080b9284909af1596.tar.gz jquery-6e7a4e73a2d821fd2a7b71e080b9284909af1596.zip |
Calling .hide().show() on a stylesheet-hidden element wasn't bringing it back. Fixes #7331.
-rw-r--r-- | src/effects.js | 2 | ||||
-rw-r--r-- | test/unit/effects.js | 10 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/effects.js b/src/effects.js index b73aa7247..d87ba8f5d 100644 --- a/src/effects.js +++ b/src/effects.js @@ -28,7 +28,7 @@ jQuery.fn.extend({ // Reset the inline display of this element to learn if it is // being hidden by cascaded rules or not if ( !jQuery.data(elem, "olddisplay") && display === "none" ) { - elem.style.display = ""; + display = elem.style.display = ""; } // Set elements which have been overridden with display: none diff --git a/test/unit/effects.js b/test/unit/effects.js index 0114b0f4c..8facb4f54 100644 --- a/test/unit/effects.js +++ b/test/unit/effects.js @@ -6,10 +6,18 @@ test("sanity check", function() { }); test("show()", function() { - expect(26); + expect(27); var hiddendiv = jQuery("div.hidden"); + hiddendiv.hide().show(); + + equals( hiddendiv.css("display"), "block", "Make sure a pre-hidden div is visible." ); + + QUnit.reset(); + + hiddendiv = jQuery("div.hidden"); + equal(jQuery.css( hiddendiv[0], "display"), "none", "hiddendiv is display: none"); hiddendiv.css("display", "block"); |