aboutsummaryrefslogtreecommitdiffstats
path: root/src/effects.js
diff options
context:
space:
mode:
authorRichard Gibson <richard.gibson@gmail.com>2014-03-20 03:39:36 -0400
committerDave Methvin <dave.methvin@gmail.com>2014-03-20 22:54:38 -0400
commit890d441aa5d319e49951ba6f0ec719cd4cb96759 (patch)
tree7cad3a1a1904a0928f84fad7de1d39e283fc3f78 /src/effects.js
parent5a8f76933288396b915800a18240aa17d3414201 (diff)
downloadjquery-890d441aa5d319e49951ba6f0ec719cd4cb96759.tar.gz
jquery-890d441aa5d319e49951ba6f0ec719cd4cb96759.zip
Effects: Don't overwrite display:none when .hide()ing hidden elements
Fixes #14848 Closes gh-1548
Diffstat (limited to 'src/effects.js')
-rw-r--r--src/effects.js15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/effects.js b/src/effects.js
index e3ccefff6..69d1effc5 100644
--- a/src/effects.js
+++ b/src/effects.js
@@ -160,11 +160,8 @@ function defaultPrefilter( elem, props, opts ) {
// Set display property to inline-block for height/width
// animations on inline elements that are having width/height animated
display = jQuery.css( elem, "display" );
- // Get default display if display is currently "none"
- if ( display === "none" ) {
- display = defaultDisplay( elem.nodeName );
- }
- if ( display === "inline" &&
+ // Test default display if display is currently "none"
+ if ( (display === "none" ? defaultDisplay( elem.nodeName ) : display) === "inline" &&
jQuery.css( elem, "float" ) === "none" ) {
style.display = "inline-block";
@@ -196,6 +193,10 @@ function defaultPrefilter( elem, props, opts ) {
}
}
orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
+
+ // Any non-fx value stops us from restoring the original display value
+ } else {
+ display = undefined;
}
}
@@ -238,6 +239,10 @@ function defaultPrefilter( elem, props, opts ) {
}
}
}
+
+ // If this is a noop like .hide().hide(), restore an overwritten display value
+ } else if ( (display === "none" ? defaultDisplay( elem.nodeName ) : display) === "inline" ) {
+ style.display = display;
}
}