Skip to content

Commit

Permalink
Calling .hide().show() on a stylesheet-hidden element wasn't bringing…
Browse files Browse the repository at this point in the history
… it back. Fixes #7331.
  • Loading branch information
jeresig committed Oct 27, 2010
1 parent 6ab402d commit 6e7a4e7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/effects.js
Expand Up @@ -28,7 +28,7 @@ jQuery.fn.extend({
// Reset the inline display of this element to learn if it is // Reset the inline display of this element to learn if it is
// being hidden by cascaded rules or not // being hidden by cascaded rules or not
if ( !jQuery.data(elem, "olddisplay") && display === "none" ) { if ( !jQuery.data(elem, "olddisplay") && display === "none" ) {
elem.style.display = ""; display = elem.style.display = "";
} }


// Set elements which have been overridden with display: none // Set elements which have been overridden with display: none
Expand Down
10 changes: 9 additions & 1 deletion test/unit/effects.js
Expand Up @@ -6,10 +6,18 @@ test("sanity check", function() {
}); });


test("show()", function() { test("show()", function() {
expect(26); expect(27);


var hiddendiv = jQuery("div.hidden"); 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"); equal(jQuery.css( hiddendiv[0], "display"), "none", "hiddendiv is display: none");


hiddendiv.css("display", "block"); hiddendiv.css("display", "block");
Expand Down

0 comments on commit 6e7a4e7

Please sign in to comment.