From feb01efc74fc51522a492ac1239721a554d3599f Mon Sep 17 00:00:00 2001 From: Stefan Wuttich Date: Wed, 29 Aug 2018 01:04:35 +0200 Subject: [PATCH] fix(ngAnimate): remove event prepare class when skipping animation --- src/ngAnimate/animation.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/ngAnimate/animation.js b/src/ngAnimate/animation.js index 227009af3be2..bdb66758cf01 100644 --- a/src/ngAnimate/animation.js +++ b/src/ngAnimate/animation.js @@ -199,6 +199,7 @@ var $$AnimationProvider = ['$animateProvider', /** @this */ function($animatePro // and it's in fact an invalid animation (something that has duration = 0) // then we should skip all the heavy work from here on if ($$animateCache.containsCachedAnimationWithoutDuration(cacheKey)) { + removePrepareClass(); closeFn(); return; } @@ -399,10 +400,7 @@ var $$AnimationProvider = ['$animateProvider', /** @this */ function($animatePro } } - function beforeStart() { - tempClasses = (tempClasses ? (tempClasses + ' ') : '') + NG_ANIMATE_CLASSNAME; - $$jqLite.addClass(element, tempClasses); - + function removePrepareClass() { var prepareClassName = element.data(PREPARE_CLASSES_KEY); if (prepareClassName) { $$jqLite.removeClass(element, prepareClassName); @@ -410,6 +408,13 @@ var $$AnimationProvider = ['$animateProvider', /** @this */ function($animatePro } } + function beforeStart() { + tempClasses = (tempClasses ? (tempClasses + ' ') : '') + NG_ANIMATE_CLASSNAME; + $$jqLite.addClass(element, tempClasses); + + removePrepareClass(); + } + function updateAnimationRunners(animation, newRunner) { if (animation.from && animation.to) { update(animation.from.element);