From d97e167f3153012d09964c263b4b76811b68a212 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 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/src/utils/animation/animation.ts b/core/src/utils/animation/animation.ts index 76436c5a8a..2de2d1404c 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 { - elements.forEach(element => { - raf(() => { + const elementsArray = elements.slice(); + + raf(() => { + elementsArray.forEach(element => { removeStyleProperty(element, 'animation-name'); removeStyleProperty(element, 'animation-duration'); removeStyleProperty(element, 'animation-timing-function');