11/**
2- * @license AngularJS v1.2.2
3- * (c) 2010-2012 Google, Inc. http://angularjs.org
2+ * @license AngularJS v1.2.3
3+ * (c) 2010-2014 Google, Inc. http://angularjs.org
44 * License: MIT
55 */
66( function ( window , angular , undefined ) { 'use strict' ;
@@ -269,9 +269,16 @@ angular.module('ngAnimate', ['ng'])
269269
270270 $rootElement . data ( NG_ANIMATE_STATE , rootAnimateState ) ;
271271
272- // disable animations during bootstrap, but once we bootstrapped, enable animations
272+ // disable animations during bootstrap, but once we bootstrapped, wait again
273+ // for another digest until enabling animations. The reason why we digest twice
274+ // is because all structural animations (enter, leave and move) all perform a
275+ // post digest operation before animating. If we only wait for a single digest
276+ // to pass then the structural animation would render its animation on page load.
277+ // (which is what we're trying to avoid when the application first boots up.)
273278 $rootScope . $$postDigest ( function ( ) {
274- rootAnimateState . running = false ;
279+ $rootScope . $$postDigest ( function ( ) {
280+ rootAnimateState . running = false ;
281+ } ) ;
275282 } ) ;
276283
277284 function lookup ( name ) {
@@ -1038,7 +1045,10 @@ angular.module('ngAnimate', ['ng'])
10381045 }
10391046
10401047 function unblockKeyframeAnimations ( element ) {
1041- element [ 0 ] . style [ ANIMATION_PROP ] = '' ;
1048+ var node = element [ 0 ] , prop = ANIMATION_PROP ;
1049+ if ( node . style [ prop ] && node . style [ prop ] . length > 0 ) {
1050+ element [ 0 ] . style [ prop ] = '' ;
1051+ }
10421052 }
10431053
10441054 function animateRun ( element , className , activeAnimationComplete ) {
@@ -1069,8 +1079,6 @@ angular.module('ngAnimate', ['ng'])
10691079 appliedStyles . push ( CSS_PREFIX + 'transition-property' ) ;
10701080 appliedStyles . push ( CSS_PREFIX + 'transition-duration' ) ;
10711081 }
1072- } else {
1073- unblockKeyframeAnimations ( element ) ;
10741082 }
10751083
10761084 if ( ii > 0 ) {
@@ -1173,6 +1181,7 @@ angular.module('ngAnimate', ['ng'])
11731181 var cancel = preReflowCancellation ;
11741182 afterReflow ( function ( ) {
11751183 unblockTransitions ( element ) ;
1184+ unblockKeyframeAnimations ( element ) ;
11761185 //once the reflow is complete then we point cancel to
11771186 //the new cancellation function which will remove all of the
11781187 //animation properties from the active animation
@@ -1238,6 +1247,7 @@ angular.module('ngAnimate', ['ng'])
12381247 if ( cancellationMethod ) {
12391248 afterReflow ( function ( ) {
12401249 unblockTransitions ( element ) ;
1250+ unblockKeyframeAnimations ( element ) ;
12411251 animationCompleted ( ) ;
12421252 } ) ;
12431253 return cancellationMethod ;
@@ -1254,6 +1264,7 @@ angular.module('ngAnimate', ['ng'])
12541264 if ( cancellationMethod ) {
12551265 afterReflow ( function ( ) {
12561266 unblockTransitions ( element ) ;
1267+ unblockKeyframeAnimations ( element ) ;
12571268 animationCompleted ( ) ;
12581269 } ) ;
12591270 return cancellationMethod ;
0 commit comments