mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
CSS: jQuery#hide should always save display value
Fixes #14750
Closes gh-1509
(cherry picked from commit 5a8f769332
)
Conflicts:
src/css.js
This commit is contained in:
parent
9ec429cf62
commit
6dcca6da36
@ -92,8 +92,6 @@ function showHide( elements, show ) {
|
|||||||
values[ index ] = jQuery._data( elem, "olddisplay", defaultDisplay(elem.nodeName) );
|
values[ index ] = jQuery._data( elem, "olddisplay", defaultDisplay(elem.nodeName) );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if ( !values[ index ] ) {
|
|
||||||
hidden = isHidden( elem );
|
hidden = isHidden( elem );
|
||||||
|
|
||||||
if ( display && display !== "none" || !hidden ) {
|
if ( display && display !== "none" || !hidden ) {
|
||||||
@ -101,7 +99,6 @@ function showHide( elements, show ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Set the display of most of the elements in a second loop
|
// Set the display of most of the elements in a second loop
|
||||||
// to avoid the constant reflow
|
// to avoid the constant reflow
|
||||||
|
@ -1106,6 +1106,16 @@ asyncTest( "Make sure initialized display value for disconnected nodes is correc
|
|||||||
jQuery._removeData( jQuery("#display")[ 0 ] );
|
jQuery._removeData( jQuery("#display")[ 0 ] );
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test( "show() after hide() should always set display to initial value (#14750)", 1, function() {
|
||||||
|
var div = jQuery( "<div />" ),
|
||||||
|
fixture = jQuery( "#qunit-fixture" );
|
||||||
|
|
||||||
|
fixture.append( div );
|
||||||
|
|
||||||
|
div.css( "display", "inline" ).hide().show().css( "display", "list-item" ).hide().show();
|
||||||
|
equal( div.css( "display" ), "list-item", "should get last set display value" );
|
||||||
|
});
|
||||||
|
|
||||||
// Support: IE < 11, Safari < 7
|
// Support: IE < 11, Safari < 7
|
||||||
// We have to jump through the hoops here in order to test work with "order" CSS property,
|
// We have to jump through the hoops here in order to test work with "order" CSS property,
|
||||||
// that some browsers do not support. This test is not, strictly speaking, correct,
|
// that some browsers do not support. This test is not, strictly speaking, correct,
|
||||||
|
Loading…
Reference in New Issue
Block a user