From c34dbf5a8d135e0f873ab7a76d1c8f8e316f31e4 Mon Sep 17 00:00:00 2001 From: Oleg Gaidarenko Date: Sat, 26 Apr 2014 21:24:05 +0400 Subject: Effects: Respect display value on inline elements Take "olddisplay" value into the account Fixes #14824 Closes gh-1566 Ref 73fe17299a840a8a7f3ffffcac15e32a88bd3d66 --- src/effects.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/effects.js b/src/effects.js index 69d1effc5..5fafc528c 100644 --- a/src/effects.js +++ b/src/effects.js @@ -116,7 +116,7 @@ function createTween( value, prop, animation ) { function defaultPrefilter( elem, props, opts ) { /* jshint validthis: true */ - var prop, value, toggle, tween, hooks, oldfire, display, + var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay, anim = this, orig = {}, style = elem.style, @@ -160,10 +160,12 @@ 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" ); + // Test default display if display is currently "none" - if ( (display === "none" ? defaultDisplay( elem.nodeName ) : display) === "inline" && - jQuery.css( elem, "float" ) === "none" ) { + checkDisplay = display === "none" ? + data_priv.get( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display; + if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) { style.display = "inline-block"; } } -- cgit v1.2.3