mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-24 03:55:49 +08:00
fix($animate): ensure former nodes are fully cleaned up when a follow-up structural animation takes place
Closes #4435
This commit is contained in:
@@ -588,6 +588,7 @@ angular.module('ngAnimate', ['ng'])
|
||||
//if an animation is currently running on the element then lets take the steps
|
||||
//to cancel that animation and fire any required callbacks
|
||||
$timeout.cancel(ngAnimateState.flagTimer);
|
||||
cleanup(element);
|
||||
cancelAnimations(ngAnimateState.animations);
|
||||
(ngAnimateState.done || noop)();
|
||||
}
|
||||
@@ -700,25 +701,24 @@ angular.module('ngAnimate', ['ng'])
|
||||
return rootAnimateState.disabled || rootAnimateState.running;
|
||||
}
|
||||
|
||||
var validState;
|
||||
do {
|
||||
//the element did not reach the root element which means that it
|
||||
//is not apart of the DOM. Therefore there is no reason to do
|
||||
//any animations on it
|
||||
if(parent.length === 0) return true;
|
||||
if(parent.length === 0) break;
|
||||
|
||||
var isRoot = parent[0] == $rootElement[0];
|
||||
var state = isRoot ? rootAnimateState : parent.data(NG_ANIMATE_STATE);
|
||||
if(state && (state.disabled != null || state.running != null)) {
|
||||
validState = state;
|
||||
break;
|
||||
var result = state && (!!state.disabled || !!state.running);
|
||||
if(isRoot || result) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if(isRoot) return true;
|
||||
}
|
||||
while(parent = parent.parent());
|
||||
|
||||
return validState ? (validState.disabled || validState.running) : true;
|
||||
return true;
|
||||
}
|
||||
}]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user