From 2f882373bf08ce6ff7ec2ffb36b73e94c20881ca Mon Sep 17 00:00:00 2001 From: Liam DeBeasi Date: Mon, 14 Oct 2019 14:18:29 -0400 Subject: [PATCH] fix(animations): ensure all elements are cleaned up when calling .destroy() (#19654) * fix race condition * remove zero --- core/src/utils/animation/animation.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/src/utils/animation/animation.ts b/core/src/utils/animation/animation.ts index 4e9e721d9e..b761e10c75 100644 --- a/core/src/utils/animation/animation.ts +++ b/core/src/utils/animation/animation.ts @@ -128,8 +128,10 @@ export const createAnimation = (): Animation => { webAnimations.length = 0; } else { + const elementsArray = elements.slice(); + raf(() => { - elements.forEach(element => { + elementsArray.forEach(element => { removeStyleProperty(element, 'animation-name'); removeStyleProperty(element, 'animation-duration'); removeStyleProperty(element, 'animation-timing-function');