-
Notifications
You must be signed in to change notification settings - Fork 27.4k
ngAnimate cache prevents transitions on added classes in FF #8813
Comments
The cache expires after the requestAnimationFrame is done so it shouldn't keep items in there afterwards. Can you provide some example code from your template or a demo? |
I can try and put something together. Interestingly I can't find requestAnimationFrame method in the code. I'm using angular v1.2.16 and seperate angular-animate |
So are you suggesting that if I force a reflow on the element then the cache should be cleared and then I can go on my merry way with transitions? |
I would need to see how your code is put together first. |
so it looks like afterReflow doesn't get called at all after i've assigned the dynamic class |
Is this by chance inside of a |
im aiming to use the "enter" animation |
OK. Anyway you can post this online somewhere? I can then debug it and figure out what's going on. |
try this? http://jsfiddle.net/mDVgX/41/ |
I can trick it into a reflow if I apply a transition to the element receiving the additional class e.g. {transition:0.01s linear all;} |
Yes there is definitely a bug going on here. Even on the latest master it's the same thing. I'm working on a fix. PS. Your demo is using a really old version of Angular. In the future please use the latest one via http:/code.angularjs.org/snapshot. |
Yes I know my apologies, just ripped off an existing setup as im pressed for time. Thanks |
@mike-suggitt the bug is consistent across 1.2 and 1.3 for all browsers. Basically if you start toggling the button before your five second timeout has passed then it permanently caches the class details thus not allowing for anything to work. 1.3 (try with Chrome and Firefox): 1.2 (try with Chrome and Firefox): |
I'm working on a fix at the moment. |
Here's the fix: http://jsfiddle.net/mDVgX/51/. I'm working on the tests for this now and then I'll merge into 1.2 and 1.3. |
$animate aims to speed up redundant calls to getComputedStyle to prevent unessarry reflows in the event that similar elements are being animated at the same time. A hidden bug was causing the GCS cache not to be reset if an CSS-based animation was not found. This patch ensures that the GCS lookup cache is always cleared after one animation reflow has passed. Closes angular#8813
$animate aims to speed up redundant calls to getComputedStyle to prevent unessarry reflows in the event that similar elements are being animated at the same time. A hidden bug was causing the GCS cache not to be reset if an CSS-based animation was not found. This patch ensures that the GCS lookup cache is always cleared after one animation reflow has passed. Closes angular#8813
$animate will cache subsequent calls to GCS in the event that the element with the same CSS classes and the same parentNode is being animated. Once the animation is started then $animate waits for one rAF before flushing the GCS lookup cache. Prior to this fix, if GCS was unable to detect any transitions or keyframes on the element then it would simply close the animation, but it would not trigger the rAF code to flush the cache. This issue caused a bug which made it difficult to detect why certain animations are not allowed to fire if the element didn't contain any CSS-based animations beforehand. Closes angular#8813
$animate will cache subsequent calls to GCS in the event that the element with the same CSS classes and the same parentNode is being animated. Once the animation is started then $animate waits for one rAF before flushing the GCS lookup cache. Prior to this fix, if GCS was unable to detect any transitions or keyframes on the element then it would simply close the animation, but it would not trigger the rAF code to flush the cache. This issue caused a bug which made it difficult to detect why certain animations are not allowed to fire if the element didn't contain any CSS-based animations beforehand. Closes #8813
$animate will cache subsequent calls to GCS in the event that the element with the same CSS classes and the same parentNode is being animated. Once the animation is started then $animate waits for one rAF before flushing the GCS lookup cache. Prior to this fix, if GCS was unable to detect any transitions or keyframes on the element then it would simply close the animation, but it would not trigger the rAF code to flush the cache. This issue caused a bug which made it difficult to detect why certain animations are not allowed to fire if the element didn't contain any CSS-based animations beforehand. Closes angular#8813
ngAnimate uses "getElementAnimationDetails" to cache CSS transitions on load but currently i'm aiming to ensure that onload there are no transitions and then after load I assign a class that then enables transitions on new items.
Example sass might be:
if I dynamically apply the "isloaded" class later on then the cache prevents ngAnimate from attaching the relevant "ng-enter" and "ng-enter-active" classes.
If I comment out the cache logic then the element gets re-evaluated and transitions are applied.
P.S seems to work in chrome bizarrely but not in firefox
The text was updated successfully, but these errors were encountered: