Skip to content
Browse files

Revert "Show an element before starting an animation to account for d…

…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...
1 parent 9aa1572 commit bfc1262662084d6da96f70d449daa4b18ec43aad @timmywil timmywil committed Jul 18, 2011
Showing with 20 additions and 24 deletions.
  1. +3 −3 src/effects.js
  2. +17 −21 test/unit/effects.js
View
6 src/effects.js
@@ -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 ) {
@@ -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
View
38 test/unit/effects.js
@@ -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();
@@ -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() {
@@ -383,7 +380,7 @@ test("animate with no properties", function() {
});
test("animate duration 0", function() {
- expect(12);
+ expect(11);
stop();
@@ -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" );
@@ -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
@@ -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);

0 comments on commit bfc1262

Please sign in to comment.
Something went wrong with that request. Please try again.