From eca1902c6f7c30505c52072140c0ab7061c452c1 Mon Sep 17 00:00:00 2001 From: Lars Hoffbeck Date: Thu, 30 May 2024 10:31:56 -0400 Subject: [PATCH] Dedupe IDs prior to injecting the new content --- assets/global.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/assets/global.js b/assets/global.js index 50c82a4accb..58552e82c34 100644 --- a/assets/global.js +++ b/assets/global.js @@ -51,8 +51,6 @@ class HTMLUpdateUtility { const newNodeWrapper = document.createElement('div'); HTMLUpdateUtility.setInnerHTML(newNodeWrapper, newContent.outerHTML); const newNode = newNodeWrapper.firstChild; - oldNode.parentNode.insertBefore(newNode, oldNode); - oldNode.style.display = 'none'; // dedupe IDs const uniqueKey = Date.now(); @@ -61,6 +59,9 @@ class HTMLUpdateUtility { element.form && element.setAttribute('form', `${element.form.getAttribute('id')}-${uniqueKey}`); }); + oldNode.parentNode.insertBefore(newNode, oldNode); + oldNode.style.display = 'none'; + this.#postProcessCallbacks.forEach((callback) => callback(newNode)); setTimeout(() => oldNode.remove(), 500);