aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatias Niemelä2013-10-03 10:52:38 -0400
committerMisko Hevery2013-10-10 17:35:36 -0700
commit7ef9dbb3df485f0525d6835cc4219ce2cbf8f611 (patch)
tree833e45485f1977c6c22f10f3deaeadcaa0d96c02
parente819d21fa02f28a64fa8176c132800da2395427e (diff)
downloadangular.js-7ef9dbb3df485f0525d6835cc4219ce2cbf8f611.tar.bz2
refactor($animate): avoid checking for transition/animation support during each animation
-rw-r--r--src/ngAnimate/animate.js15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/ngAnimate/animate.js b/src/ngAnimate/animate.js
index 7fcdef73..5aed6832 100644
--- a/src/ngAnimate/animate.js
+++ b/src/ngAnimate/animate.js
@@ -215,8 +215,11 @@ angular.module('ngAnimate', ['ng'])
//the empty string value is the default animation
//operation which performs CSS transition and keyframe
//animations sniffing. This is always included for each
- //element animation procedure
- classes.push('');
+ //element animation procedure if the browser supports
+ //transitions and/or keyframe animations
+ if ($sniffer.transitions || $sniffer.animations) {
+ classes.push('');
+ }
for(var i=0; i < classes.length; 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
//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
//data or className values since this happens earlier than that
//and also use a timeout so that it won't be asynchronous
@@ -579,11 +582,7 @@ angular.module('ngAnimate', ['ng'])
ELEMENT_NODE = 1;
function animate(element, className, done) {
- if (!($sniffer.transitions || $sniffer.animations)) {
- done();
- return;
- }
- else if(['ng-enter','ng-leave','ng-move'].indexOf(className) == -1) {
+ if(['ng-enter','ng-leave','ng-move'].indexOf(className) == -1) {
var existingDuration = 0;
forEach(element, function(element) {
if (element.nodeType == ELEMENT_NODE) {