Navigation Menu

Skip to content

Commit

Permalink
Revert "Show an element before starting an animation to account for d…
Browse files Browse the repository at this point in the history
…uration 0 or fx.off animations. Fixes #8892."

This reverts commit 19b949c.

- Show needs to be called after the first tick to avoid flashes.
  • Loading branch information
timmywil committed Jul 18, 2011
1 parent 9aa1572 commit bfc1262
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 24 deletions.
6 changes: 3 additions & 3 deletions src/effects.js
Expand Up @@ -441,9 +441,6 @@ jQuery.fx.prototype = {
this.options.orig[ this.prop ] = dataShow || jQuery.style( this.elem, this.prop );
this.options.show = true;

// Start by showing the element
jQuery( this.elem ).show();

// Begin the animation
// Make sure that we start at a small width/height to avoid any flash of content
if ( dataShow !== undefined ) {
Expand All @@ -452,6 +449,9 @@ jQuery.fx.prototype = {
} else {
this.custom( this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur() );
}

// Start by showing the element
jQuery( this.elem ).show();
},

// Simple 'hide' function
Expand Down
38 changes: 17 additions & 21 deletions test/unit/effects.js
Expand Up @@ -138,7 +138,7 @@ test("show(Number) - other displays", function() {

// Supports #7397
test("Persist correct display value", function() {
expect(4);
expect(3);
QUnit.reset();
stop();

Expand All @@ -155,19 +155,16 @@ test("Persist correct display value", function() {

$span.hide();

$span.fadeIn(0, function() {
$span.fadeIn(100, function() {
equals($span.css("display"), display, "Expecting display: " + display);
$span.fadeIn(100, function() {
equals($span.css("display"), display, "Expecting display: " + display);
$span.fadeOut(100, function () {
equals($span.css("display"), displayNone, "Expecting display: " + displayNone);
$span.fadeIn(100, function() {
equals($span.css("display"), display, "Expecting display: " + display);
start();
});
$span.fadeOut(100, function () {
equals($span.css("display"), displayNone, "Expecting display: " + displayNone);
$span.fadeIn(100, function() {
equals($span.css("display"), display, "Expecting display: " + display);
start();
});
});
})
});
});

test("show() resolves correct default display #8099", function() {
Expand Down Expand Up @@ -383,7 +380,7 @@ test("animate with no properties", function() {
});

test("animate duration 0", function() {
expect(12);
expect(11);

stop();

Expand All @@ -396,7 +393,8 @@ test("animate duration 0", function() {
counter++;
});

equals( jQuery.timers.length, 0, "Make sure synchronous animations are not left on jQuery.timers (#6115)" );
// Failed until [6115]
equals( jQuery.timers.length, 0, "Make sure synchronic animations are not left on jQuery.timers" );

equals( counter, 1, "One synchronic animations" );

Expand All @@ -405,27 +403,25 @@ test("animate duration 0", function() {
counter++;
});

equals( counter, 3, "Multiple synchronous animations" );
equals( counter, 3, "Multiple synchronic animations" );

$elems.eq(0).animate( {a:3}, 0, function(){
ok( true, "Animate a third simple property." );
counter++;
});
$elems.eq(1).animate( {a:3}, 200, function(){
counter++;
equals( counter, 5, "One synchronous and one asynchronous (#6115)" );
// Failed until [6115]
equals( counter, 5, "One synchronic and one asynchronic" );
start();
});

var $elem = jQuery("<div />").appendTo("#fx-tests");
var $elem = jQuery("<div />");
$elem.show(0, function(){
ok(true, "Show callback with no duration");
});
$elem.hide(0, function(){
equal( $elem.css("display"), "none", "Hide callback with no duration" );
});
$elem.fadeIn(0, function() {
ok( $elem.is(":visible"), "Duration zero animations still have visible elements at time of callback (#8892)" );
ok(true, "Hide callback with no duration");
});

// manually clean up detached elements
Expand Down Expand Up @@ -594,7 +590,7 @@ test("toggle()", function() {
ok( x.is(":visible"), "is visible again" );
});

jQuery.checkOverflowDisplay = function() {
jQuery.checkOverflowDisplay = function(){
var o = jQuery.css( this, "overflow" );

equals(o, "visible", "Overflow should be visible: " + o);
Expand Down

0 comments on commit bfc1262

Please sign in to comment.