From 7be7cf021071c1c5f93c4ddb56aed4d206413372 Mon Sep 17 00:00:00 2001 From: DarkWiiPlayer Date: Wed, 10 Jan 2024 22:47:30 +0100 Subject: [PATCH] Change DOMState value to last static value --- state.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/state.js b/state.js index 7aa9a5d..7bc12c8 100644 --- a/state.js +++ b/state.js @@ -348,12 +348,13 @@ export class DOMState extends SimpleState { #old #options #changedValue = false + #value constructor(target, value, options) { super() this.#options = options this.#old = [...value] - this.value = value + this.#value = value const controller = new AbortController() mutationObserver.observe(target, { attributes: true, @@ -365,8 +366,10 @@ export class DOMState extends SimpleState { abortRegistry.register(this, controller) } + get value() { return this.#old } + update() { - const current = [...this.value] + const current = [...this.#value] if (current.length === this.#old.length) { for (const idx in current) { if (current[idx] !== this.#old[idx]) break