mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-17 03:01:06 +00:00
refactor($animate): avoid checking for transition/animation support during each animation
This commit is contained in:
parent
e819d21fa0
commit
7ef9dbb3df
1 changed files with 7 additions and 8 deletions
|
|
@ -215,8 +215,11 @@ angular.module('ngAnimate', ['ng'])
|
||||||
//the empty string value is the default animation
|
//the empty string value is the default animation
|
||||||
//operation which performs CSS transition and keyframe
|
//operation which performs CSS transition and keyframe
|
||||||
//animations sniffing. This is always included for each
|
//animations sniffing. This is always included for each
|
||||||
//element animation procedure
|
//element animation procedure if the browser supports
|
||||||
classes.push('');
|
//transitions and/or keyframe animations
|
||||||
|
if ($sniffer.transitions || $sniffer.animations) {
|
||||||
|
classes.push('');
|
||||||
|
}
|
||||||
|
|
||||||
for(var i=0; i < classes.length; i++) {
|
for(var i=0; i < classes.length; i++) {
|
||||||
var klass = classes[i],
|
var klass = classes[i],
|
||||||
|
|
@ -477,7 +480,7 @@ angular.module('ngAnimate', ['ng'])
|
||||||
|
|
||||||
//skip the animation if animations are disabled, a parent is already being animated
|
//skip the animation if animations are disabled, a parent is already being animated
|
||||||
//or the element is not currently attached to the document body.
|
//or the element is not currently attached to the document body.
|
||||||
if ((parent.inheritedData(NG_ANIMATE_STATE) || disabledAnimation).running) {
|
if ((parent.inheritedData(NG_ANIMATE_STATE) || disabledAnimation).running || animations.length == 0) {
|
||||||
//avoid calling done() since there is no need to remove any
|
//avoid calling done() since there is no need to remove any
|
||||||
//data or className values since this happens earlier than that
|
//data or className values since this happens earlier than that
|
||||||
//and also use a timeout so that it won't be asynchronous
|
//and also use a timeout so that it won't be asynchronous
|
||||||
|
|
@ -579,11 +582,7 @@ angular.module('ngAnimate', ['ng'])
|
||||||
ELEMENT_NODE = 1;
|
ELEMENT_NODE = 1;
|
||||||
|
|
||||||
function animate(element, className, done) {
|
function animate(element, className, done) {
|
||||||
if (!($sniffer.transitions || $sniffer.animations)) {
|
if(['ng-enter','ng-leave','ng-move'].indexOf(className) == -1) {
|
||||||
done();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if(['ng-enter','ng-leave','ng-move'].indexOf(className) == -1) {
|
|
||||||
var existingDuration = 0;
|
var existingDuration = 0;
|
||||||
forEach(element, function(element) {
|
forEach(element, function(element) {
|
||||||
if (element.nodeType == ELEMENT_NODE) {
|
if (element.nodeType == ELEMENT_NODE) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue