vendor/assets/javascripts/angular-animate.js in angular-gem-1.2.2 vs vendor/assets/javascripts/angular-animate.js in angular-gem-1.2.3

- old
+ new

@@ -1,8 +1,8 @@ /** - * @license AngularJS v1.2.2 - * (c) 2010-2012 Google, Inc. http://angularjs.org + * @license AngularJS v1.2.3 + * (c) 2010-2014 Google, Inc. http://angularjs.org * License: MIT */ (function(window, angular, undefined) {'use strict'; /* jshint maxlen: false */ @@ -267,13 +267,20 @@ $provide.decorator('$animate', ['$delegate', '$injector', '$sniffer', '$rootElement', '$timeout', '$rootScope', '$document', function($delegate, $injector, $sniffer, $rootElement, $timeout, $rootScope, $document) { $rootElement.data(NG_ANIMATE_STATE, rootAnimateState); - // disable animations during bootstrap, but once we bootstrapped, enable animations + // disable animations during bootstrap, but once we bootstrapped, wait again + // for another digest until enabling animations. The reason why we digest twice + // is because all structural animations (enter, leave and move) all perform a + // post digest operation before animating. If we only wait for a single digest + // to pass then the structural animation would render its animation on page load. + // (which is what we're trying to avoid when the application first boots up.) $rootScope.$$postDigest(function() { - rootAnimateState.running = false; + $rootScope.$$postDigest(function() { + rootAnimateState.running = false; + }); }); function lookup(name) { if (name) { var matches = [], @@ -1036,11 +1043,14 @@ node.style[prop] = ''; } } function unblockKeyframeAnimations(element) { - element[0].style[ANIMATION_PROP] = ''; + var node = element[0], prop = ANIMATION_PROP; + if(node.style[prop] && node.style[prop].length > 0) { + element[0].style[prop] = ''; + } } function animateRun(element, className, activeAnimationComplete) { var data = element.data(NG_ANIMATE_CSS_DATA_KEY); if(!element.hasClass(className) || !data) { @@ -1067,12 +1077,10 @@ style += CSS_PREFIX + 'transition-property: ' + propertyStyle + ', ' + fallbackProperty + '; '; style += CSS_PREFIX + 'transition-duration: ' + timings.transitionDurationStyle + ', ' + timings.transitionDuration + 's; '; appliedStyles.push(CSS_PREFIX + 'transition-property'); appliedStyles.push(CSS_PREFIX + 'transition-duration'); } - } else { - unblockKeyframeAnimations(element); } if(ii > 0) { if(stagger.transitionDelay > 0 && stagger.transitionDuration === 0) { var delayStyle = timings.transitionDelayStyle; @@ -1171,10 +1179,11 @@ //data from the element which will not make the 2nd animation //happen in the first place var cancel = preReflowCancellation; afterReflow(function() { unblockTransitions(element); + unblockKeyframeAnimations(element); //once the reflow is complete then we point cancel to //the new cancellation function which will remove all of the //animation properties from the active animation cancel = animateAfter(element, className, animationComplete); }); @@ -1236,10 +1245,11 @@ beforeAddClass : function(element, className, animationCompleted) { var cancellationMethod = animateBefore(element, suffixClasses(className, '-add')); if(cancellationMethod) { afterReflow(function() { unblockTransitions(element); + unblockKeyframeAnimations(element); animationCompleted(); }); return cancellationMethod; } animationCompleted(); @@ -1252,9 +1262,10 @@ beforeRemoveClass : function(element, className, animationCompleted) { var cancellationMethod = animateBefore(element, suffixClasses(className, '-remove')); if(cancellationMethod) { afterReflow(function() { unblockTransitions(element); + unblockKeyframeAnimations(element); animationCompleted(); }); return cancellationMethod; } animationCompleted();