Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 64c66d0

Browse files
committed
fix(ngAnimate): ensure anchored animations remove the leave element at correct time
Due to a mismatch of where the `options.domOperation` value was stored, the element involved in the `leave` animation for an anchored animation session was not removed as soon as the leave animation ended. This resulted in a pending element persisting within the DOM until all animations involved in the associated anchor animation were complete. This patch fixes this issue. Closes #11850
1 parent 13e38db commit 64c66d0

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/ngAnimate/animateCssDriver.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,12 @@ var $$AnimateCssDriverProvider = ['$$animationProvider', function($$animationPro
234234

235235
// we special case the leave animation since we want to ensure that
236236
// the element is removed as soon as the animation is over. Otherwise
237-
// a flicker might appear or the element may not be removed at all
237+
// a flicker might appear or the element may not be removed until all
238+
// the other animations have completed themselves (which would then
239+
// leave a pending element in the background).
238240
options.event = animationDetails.event;
239-
if (options.event === 'leave' && animationDetails.domOperation) {
240-
options.onDone = animationDetails.domOperation;
241+
if (options.event === 'leave') {
242+
options.onDone = options.domOperation;
241243
}
242244

243245
var animator = $animateCss(element, options);

test/ngAnimate/animateCssDriverSpec.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -908,10 +908,12 @@ describe("ngAnimate $$animateCssDriver", function() {
908908
inject(function($rootElement, $$rAF) {
909909

910910
toAnimation.event = 'enter';
911+
toAnimation.options = {};
911912
fromAnimation.event = 'leave';
913+
fromAnimation.options = {};
912914

913915
var leaveOp = function() { };
914-
fromAnimation.domOperation = leaveOp;
916+
fromAnimation.options.domOperation = leaveOp;
915917

916918
driver({
917919
from: fromAnimation,

0 commit comments

Comments
 (0)