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

Commit b9557b0

Browse files
gregolskymatsko
authored andcommitted
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
1 parent 280e33d commit b9557b0

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/ngAnimate/animate.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ angular.module('ngAnimate', ['ng'])
199199
var forEach = angular.forEach;
200200
var selectors = $animateProvider.$$selectors;
201201

202+
var ELEMENT_NODE = 1;
202203
var NG_ANIMATE_STATE = '$$ngAnimateState';
203204
var NG_ANIMATE_CLASS_NAME = 'ng-animate';
204205
var rootAnimateState = {running:true};
@@ -583,7 +584,12 @@ angular.module('ngAnimate', ['ng'])
583584
}
584585

585586
function cancelChildAnimations(element) {
586-
angular.forEach(element[0].querySelectorAll('.' + NG_ANIMATE_CLASS_NAME), function(element) {
587+
var node = element[0];
588+
if(node.nodeType != ELEMENT_NODE) {
589+
return;
590+
}
591+
592+
angular.forEach(node.querySelectorAll('.' + NG_ANIMATE_CLASS_NAME), function(element) {
587593
element = angular.element(element);
588594
var data = element.data(NG_ANIMATE_STATE);
589595
if(data) {
@@ -639,8 +645,7 @@ angular.module('ngAnimate', ['ng'])
639645
var durationKey = 'Duration',
640646
propertyKey = 'Property',
641647
delayKey = 'Delay',
642-
animationIterationCountKey = 'IterationCount',
643-
ELEMENT_NODE = 1;
648+
animationIterationCountKey = 'IterationCount';
644649

645650
var NG_ANIMATE_PARENT_KEY = '$ngAnimateKey';
646651
var lookupCache = {};

0 commit comments

Comments
 (0)