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

Commit

Permalink
fix(ngAnimate): ignore children without animation runner when closing…
Browse files Browse the repository at this point in the history
… 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 #13423
  • Loading branch information
Narretz committed Dec 1, 2015
1 parent 73e3865 commit 729fc4f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/ngAnimate/animateQueue.js
Original file line number Diff line number Diff line change
Expand Up @@ -507,15 +507,15 @@ var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
forEach(children, function(child) {
var state = parseInt(child.getAttribute(NG_ANIMATE_ATTR_NAME));
var animationDetails = activeAnimationsLookup.get(child);
switch (state) {
case RUNNING_STATE:
animationDetails.runner.end();
/* falls through */
case PRE_DIGEST_STATE:
if (animationDetails) {
if (animationDetails) {
switch (state) {
case RUNNING_STATE:
animationDetails.runner.end();
/* falls through */
case PRE_DIGEST_STATE:
activeAnimationsLookup.remove(child);
break;
}
break;
}
});
}
Expand Down
20 changes: 20 additions & 0 deletions test/ngAnimate/animateSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,26 @@ describe("animations", function() {
expect(isCancelled).toBe(true);
}));

it('should ignore an apparently ongoing post-digest child animation that has no animation data',
inject(function($rootScope, $rootElement, $animate) {

parent.append(element);

$animate.addClass(element, 'rumlow');

$rootScope.$digest();
expect(capturedAnimation[0]).toBe(element);

// If an element is cloned during an animation, it still has the data-attributes indicating
// an animation
var clone = element.clone();
parent.append(clone);

$animate.move(parent, null, parent2);
$rootScope.$digest();
expect(capturedAnimation[0]).toBe(parent);
}));

it('should not end any child animations if a parent class-based animation is issued',
inject(function($rootScope, $rootElement, $animate) {

Expand Down

0 comments on commit 729fc4f

Please sign in to comment.