aboutsummaryrefslogtreecommitdiffstats
path: root/src/ngAnimate
diff options
context:
space:
mode:
authorMatias Niemelä2014-02-24 14:47:12 -0500
committerMatias Niemelä2014-02-26 14:23:47 -0500
commit99720fb5ab7259af37f708bc4eeda7cbbe790a69 (patch)
treeec032b6e4245e16310ebf5702f733b6531687508 /src/ngAnimate
parent332e935048d161764046b43fe6599e1db2afc3b6 (diff)
downloadangular.js-99720fb5ab7259af37f708bc4eeda7cbbe790a69.tar.bz2
fix($animate): ensure all animated elements are taken care of during the closing timeout
Closes #6395
Diffstat (limited to 'src/ngAnimate')
-rw-r--r--src/ngAnimate/animate.js13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/ngAnimate/animate.js b/src/ngAnimate/animate.js
index 6b7fbcce..c09e714e 100644
--- a/src/ngAnimate/animate.js
+++ b/src/ngAnimate/animate.js
@@ -1063,6 +1063,15 @@ angular.module('ngAnimate', ['ng'])
var closingTimestamp = 0;
var animationElementQueue = [];
function animationCloseHandler(element, totalTime) {
+ var node = extractElementNode(element);
+ element = angular.element(node);
+
+ //this item will be garbage collected by the closing
+ //animation timeout
+ animationElementQueue.push(element);
+
+ //but it may not need to cancel out the existing timeout
+ //if the timestamp is less than the previous one
var futureTimestamp = Date.now() + (totalTime * 1000);
if(futureTimestamp <= closingTimestamp) {
return;
@@ -1070,10 +1079,6 @@ angular.module('ngAnimate', ['ng'])
$timeout.cancel(closingTimer);
- var node = extractElementNode(element);
- element = angular.element(node);
- animationElementQueue.push(element);
-
closingTimestamp = futureTimestamp;
closingTimer = $timeout(function() {
closeAllAnimations(animationElementQueue);