fix(ngAnimate): fix cancelChildAnimations throwing exception

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 #4548
This commit is contained in:
Grzegorz Lachowski 2013-10-21 18:50:48 +02:00 committed by Matias Niemelä
parent 280e33d22a
commit b9557b0a86

View file

@ -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};
@ -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) {
@ -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 = {};