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,
// 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";
}
}
clock.tick( 10 );
});
+test( "Respect display value on inline elements (#14824)", 2, function() {
+ var clock = this.clock,
+ fromStyleSheet = jQuery( "<span id='span-14824' />" ),
+ fromStyleAttr = jQuery( "<span style='display: block;' />" );
+
+ jQuery( "#qunit-fixture" ).append( fromStyleSheet, fromStyleAttr );
+
+ fromStyleSheet.slideUp(function() {
+ jQuery( this ).slideDown( function() {
+ equal( jQuery( this ).css( "display" ), "block",
+ "Respect previous display value (from stylesheet) on span element" );
+ });
+ });
+
+ fromStyleAttr.slideUp( function() {
+ jQuery( this ).slideDown( function() {
+ equal( jQuery( this ).css( "display" ), "block",
+ "Respect previous display value (from style attribute) on span element" );
+ });
+ });
+
+ clock.tick( 800 );
+});
+
})();