From 483399462b48bc615b25c767325b7ec10646cc41 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Tue, 25 Jun 2024 13:16:33 +0200 Subject: [PATCH] fix(dom): Cancel the requestAnimationFrame when all roots are disconnected (#633) --- fluent-dom/src/dom_localization.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fluent-dom/src/dom_localization.js b/fluent-dom/src/dom_localization.js index 21d1bfbd..3b6c8ae0 100644 --- a/fluent-dom/src/dom_localization.js +++ b/fluent-dom/src/dom_localization.js @@ -168,6 +168,9 @@ export default class DOMLocalization extends Localization { if (this.roots.size === 0) { this.mutationObserver = null; + if (this.windowElement && this.pendingrAF) { + this.windowElement.cancelAnimationFrame(this.pendingrAF); + } this.windowElement = null; this.pendingrAF = null; this.pendingElements.clear();