aboutsummaryrefslogtreecommitdiffstats
path: root/src/css.js
diff options
context:
space:
mode:
authorOleg <markelog@gmail.com>2013-02-01 17:22:08 +0400
committerDave Methvin <dave.methvin@gmail.com>2013-02-04 15:22:07 -0500
commitf3db084f7cc73379b0d6f5341c987e2a801ea032 (patch)
tree64a89004e60c206c3578b06c66633f87471c9a12 /src/css.js
parenta30785a4dde7430d11eeb94980831ffcca39e2f8 (diff)
downloadjquery-f3db084f7cc73379b0d6f5341c987e2a801ea032.tar.gz
jquery-f3db084f7cc73379b0d6f5341c987e2a801ea032.zip
Fix #13310. Get the right display value for disconnected nodes. Close gh-1156.
Diffstat (limited to 'src/css.js')
-rw-r--r--src/css.js17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/css.js b/src/css.js
index 9cd38b287..e8edd9f73 100644
--- a/src/css.js
+++ b/src/css.js
@@ -54,7 +54,7 @@ function getStyles( elem ) {
}
function showHide( elements, show ) {
- var elem,
+ var display, elem, hidden,
values = [],
index = 0,
length = elements.length;
@@ -64,11 +64,13 @@ function showHide( elements, show ) {
if ( !elem.style ) {
continue;
}
+
values[ index ] = jQuery._data( elem, "olddisplay" );
+ display = elem.style.display;
if ( show ) {
// Reset the inline display of this element to learn if it is
// being hidden by cascaded rules or not
- if ( !values[ index ] && elem.style.display === "none" ) {
+ if ( !values[ index ] && display === "none" ) {
elem.style.display = "";
}
@@ -78,8 +80,15 @@ function showHide( elements, show ) {
if ( elem.style.display === "" && isHidden( elem ) ) {
values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) );
}
- } else if ( !values[ index ] && !isHidden( elem ) ) {
- jQuery._data( elem, "olddisplay", jQuery.css( elem, "display" ) );
+ } else {
+
+ if ( !values[ index ] ) {
+ hidden = isHidden( elem );
+
+ if ( display && display !== "none" || !hidden ) {
+ jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) );
+ }
+ }
}
}