From b0d7ed481fc24ffd4226ad2a48556e5d6b3fc94b Mon Sep 17 00:00:00 2001 From: John Factotum <50942278+johnfactotum@users.noreply.github.com> Date: Sat, 23 Mar 2024 12:12:39 +0800 Subject: [PATCH] Paginator: destroy view before removing it --- paginator.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/paginator.js b/paginator.js index 9758c24..b301e4e 100644 --- a/paginator.js +++ b/paginator.js @@ -533,7 +533,10 @@ export class Paginator extends HTMLElement { this.sections = book.sections } #createView() { - if (this.#view) this.#container.removeChild(this.#view.element) + if (this.#view) { + this.#view.destroy() + this.#container.removeChild(this.#view.element) + } this.#view = new View({ container: this, onExpand: () => this.scrollToAnchor(this.#anchor),