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

Commit d2e8f55

Browse files
committed
fix(ngAnimate): ignore children without animation runner when closing them
During parent structural animations, ongoing animations on child elements are closed. These children are looked up by checking the data-ng-animate attribute. If an element is the clone of an animating element, it might have this attribute, but no animation runner associated with it, so we need to ignore it. Fixes #11992 Closes #13424
1 parent 73e3865 commit d2e8f55

File tree

2 files changed

+27
-7
lines changed

2 files changed

+27
-7
lines changed

src/ngAnimate/animateQueue.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -507,15 +507,15 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
507507
forEach(children, function(child) {
508508
var state = parseInt(child.getAttribute(NG_ANIMATE_ATTR_NAME));
509509
var animationDetails = activeAnimationsLookup.get(child);
510-
switch (state) {
511-
case RUNNING_STATE:
512-
animationDetails.runner.end();
513-
/* falls through */
514-
case PRE_DIGEST_STATE:
515-
if (animationDetails) {
510+
if (animationDetails) {
511+
switch (state) {
512+
case RUNNING_STATE:
513+
animationDetails.runner.end();
514+
/* falls through */
515+
case PRE_DIGEST_STATE:
516516
activeAnimationsLookup.remove(child);
517+
break;
517518
}
518-
break;
519519
}
520520
});
521521
}

test/ngAnimate/animateSpec.js

+20
Original file line numberDiff line numberDiff line change
@@ -850,6 +850,26 @@ describe("animations", function() {
850850
expect(isCancelled).toBe(true);
851851
}));
852852

853+
it('should ignore an apparently ongoing post-digest child animation that has no animation data',
854+
inject(function($rootScope, $rootElement, $animate) {
855+
856+
parent.append(element);
857+
858+
$animate.addClass(element, 'rumlow');
859+
860+
$rootScope.$digest();
861+
expect(capturedAnimation[0]).toBe(element);
862+
863+
// If an element is cloned during an animation, it still has the data-attributes indicating
864+
// an animation
865+
var clone = element.clone();
866+
parent.append(clone);
867+
868+
$animate.move(parent, null, parent2);
869+
$rootScope.$digest();
870+
expect(capturedAnimation[0]).toBe(parent);
871+
}));
872+
853873
it('should not end any child animations if a parent class-based animation is issued',
854874
inject(function($rootScope, $rootElement, $animate) {
855875

0 commit comments

Comments
 (0)