Skip to content

Commit 6e7a4e7

Browse files
committed
Calling .hide().show() on a stylesheet-hidden element wasn't bringing it back. Fixes #7331.
1 parent 6ab402d commit 6e7a4e7

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/effects.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jQuery.fn.extend({
2828
// Reset the inline display of this element to learn if it is
2929
// being hidden by cascaded rules or not
3030
if ( !jQuery.data(elem, "olddisplay") && display === "none" ) {
31-
elem.style.display = "";
31+
display = elem.style.display = "";
3232
}
3333

3434
// Set elements which have been overridden with display: none

test/unit/effects.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,18 @@ test("sanity check", function() {
66
});
77

88
test("show()", function() {
9-
expect(26);
9+
expect(27);
1010

1111
var hiddendiv = jQuery("div.hidden");
1212

13+
hiddendiv.hide().show();
14+
15+
equals( hiddendiv.css("display"), "block", "Make sure a pre-hidden div is visible." );
16+
17+
QUnit.reset();
18+
19+
hiddendiv = jQuery("div.hidden");
20+
1321
equal(jQuery.css( hiddendiv[0], "display"), "none", "hiddendiv is display: none");
1422

1523
hiddendiv.css("display", "block");

0 commit comments

Comments
 (0)