aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrzegorz Lachowski2013-10-21 18:50:48 +0200
committerMatias Niemelä2013-10-22 15:09:52 -0400
commitb9557b0a86206d938a738ea470736d011dff7e1a (patch)
tree65037b79f62cd09653b048faf8327d7516a06929
parent280e33d22a744b494395abdca639fa54eb6bb779 (diff)
downloadangular.js-b9557b0a86206d938a738ea470736d011dff7e1a.tar.bz2
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
-rw-r--r--src/ngAnimate/animate.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/ngAnimate/animate.js b/src/ngAnimate/animate.js
index 88a72073..a58e02d2 100644
--- a/src/ngAnimate/animate.js
+++ b/src/ngAnimate/animate.js
@@ -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 = {};