aboutsummaryrefslogtreecommitdiffstats
path: root/src/effects.js
diff options
context:
space:
mode:
authorTimmy Willison <timmywillisn@gmail.com>2013-09-10 14:57:14 -0500
committerTimmy Willison <timmywillisn@gmail.com>2013-09-10 14:57:14 -0500
commit73fe17299a840a8a7f3ffffcac15e32a88bd3d66 (patch)
tree4110fc152f4f41b5fb53c426a01512331a20f89a /src/effects.js
parentac60f1071ddb460fec6ddee1bf6edacd414c3b35 (diff)
downloadjquery-73fe17299a840a8a7f3ffffcac15e32a88bd3d66.tar.gz
jquery-73fe17299a840a8a7f3ffffcac15e32a88bd3d66.zip
Ensure display: inline-block when animating width/height on inline elements. Fixes #14344.
Diffstat (limited to 'src/effects.js')
-rw-r--r--src/effects.js13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/effects.js b/src/effects.js
index e61e576cb..b2d206850 100644
--- a/src/effects.js
+++ b/src/effects.js
@@ -5,7 +5,9 @@ var
pnum = require( "./var/pnum" ),
cssExpand = require( "./css/var/cssExpand" ),
isHidden = require( "./css/var/isHidden" ),
+ defaultDisplay = require( "./css/defaultDisplay" ),
data_priv = require( "./data/var/data_priv" ),
+
fxNow, timerId,
rfxtypes = /^(?:toggle|show|hide)$/,
rfxnum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ),
@@ -86,7 +88,7 @@ function genFx( type, includeWidth ) {
// if we include width, step value is 1 to do all cssExpand values,
// if we don't include width, step value is 2 to skip over Left and Right
- includeWidth = includeWidth? 1 : 0;
+ includeWidth = includeWidth ? 1 : 0;
for( ; i < 4 ; i += 2 - includeWidth ) {
which = cssExpand[ i ];
attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
@@ -115,7 +117,7 @@ function createTween( value, prop, animation ) {
function defaultPrefilter( elem, props, opts ) {
/* jshint validthis: true */
- var prop, value, toggle, tween, hooks, oldfire,
+ var prop, value, toggle, tween, hooks, oldfire, display,
anim = this,
orig = {},
style = elem.style,
@@ -158,7 +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
- if ( jQuery.css( elem, "display" ) === "inline" &&
+ display = jQuery.css( elem, "display" );
+ // Get default display if display is currently "none"
+ if ( display === "none" ) {
+ display = defaultDisplay( elem.nodeName );
+ }
+ if ( display === "inline" &&
jQuery.css( elem, "float" ) === "none" ) {
style.display = "inline-block";