diff --git a/src/ngAnimate/animate.js b/src/ngAnimate/animate.js index e66fcd6e1cfc..f78adcdc372f 100644 --- a/src/ngAnimate/animate.js +++ b/src/ngAnimate/animate.js @@ -1419,6 +1419,16 @@ angular.module('ngAnimate', ['ng']) var parentCounter = 0; var animationReflowQueue = []; var cancelAnimationReflow; + function clearCacheAfterReflow() { + if (!cancelAnimationReflow) { + cancelAnimationReflow = $$animateReflow(function() { + animationReflowQueue = []; + cancelAnimationReflow = null; + lookupCache = {}; + }); + } + } + function afterReflow(element, callback) { if (cancelAnimationReflow) { cancelAnimationReflow(); @@ -1764,6 +1774,7 @@ angular.module('ngAnimate', ['ng']) //to perform at all var preReflowCancellation = animateBefore(animationEvent, element, className); if (!preReflowCancellation) { + clearCacheAfterReflow(); animationComplete(); return; } @@ -1820,6 +1831,7 @@ angular.module('ngAnimate', ['ng']) afterReflow(element, animationCompleted); return cancellationMethod; } + clearCacheAfterReflow(); animationCompleted(); }, @@ -1829,6 +1841,7 @@ angular.module('ngAnimate', ['ng']) afterReflow(element, animationCompleted); return cancellationMethod; } + clearCacheAfterReflow(); animationCompleted(); }, @@ -1838,6 +1851,7 @@ angular.module('ngAnimate', ['ng']) afterReflow(element, animationCompleted); return cancellationMethod; } + clearCacheAfterReflow(); animationCompleted(); }, diff --git a/test/ngAnimate/animateSpec.js b/test/ngAnimate/animateSpec.js index a571464e2142..b738f1e1ef61 100644 --- a/test/ngAnimate/animateSpec.js +++ b/test/ngAnimate/animateSpec.js @@ -3757,6 +3757,64 @@ describe("ngAnimate", function() { expect(inner.hasClass('on-add-active')).toBe(false); })); + it("should reset the getComputedStyle lookup cache even when no animation is found", + inject(function($compile, $rootScope, $animate, $sniffer, $document) { + + if (!$sniffer.transitions) return; + + $animate.enabled(); + + var html = '