Skip to content

Commit

Permalink
fix(ngAnimate): fix cancelChildAnimations throwing exception
Browse files Browse the repository at this point in the history
fix ngAnimate throwing exception in cancelChildAnimations on deletion of
element (ngAnimate's leave decorator) of repeated element when using
ng-include on this element.

Closes angular#4548
  • Loading branch information
gregolsky authored and jamesdaily committed Jan 27, 2014
1 parent 60f7f2a commit 5a654c1
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/ngAnimate/animate.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ angular.module('ngAnimate', ['ng'])
var forEach = angular.forEach;
var selectors = $animateProvider.$$selectors;

var ELEMENT_NODE = 1;
var NG_ANIMATE_STATE = '$$ngAnimateState';
var NG_ANIMATE_CLASS_NAME = 'ng-animate';
var rootAnimateState = {running:true};
Expand Down Expand Up @@ -583,7 +584,12 @@ angular.module('ngAnimate', ['ng'])
}

function cancelChildAnimations(element) {
angular.forEach(element[0].querySelectorAll('.' + NG_ANIMATE_CLASS_NAME), function(element) {
var node = element[0];
if(node.nodeType != ELEMENT_NODE) {
return;
}

angular.forEach(node.querySelectorAll('.' + NG_ANIMATE_CLASS_NAME), function(element) {
element = angular.element(element);
var data = element.data(NG_ANIMATE_STATE);
if(data) {
Expand Down Expand Up @@ -639,8 +645,7 @@ angular.module('ngAnimate', ['ng'])
var durationKey = 'Duration',
propertyKey = 'Property',
delayKey = 'Delay',
animationIterationCountKey = 'IterationCount',
ELEMENT_NODE = 1;
animationIterationCountKey = 'IterationCount';

var NG_ANIMATE_PARENT_KEY = '$ngAnimateKey';
var lookupCache = {};
Expand Down

0 comments on commit 5a654c1

Please sign in to comment.