From c2403579228df4b9cb26c4e9184e2b15a0ce35f7 Mon Sep 17 00:00:00 2001 From: David Larlet Date: Mon, 29 Jul 2024 21:15:24 -0400 Subject: [PATCH] fix: do not rely on the `hasChildNodes()` method Introduced in 5ba1c28408613a631e0bd299111a78978fdb7b5a TIL: `hasChildNodes()` is sensitive to white spaces. --- umap/templates/umap/user_dashboard.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/umap/templates/umap/user_dashboard.html b/umap/templates/umap/user_dashboard.html index c1120ed6..9459ee66 100644 --- a/umap/templates/umap/user_dashboard.html +++ b/umap/templates/umap/user_dashboard.html @@ -59,7 +59,7 @@ const button = event.target.closest('button') button.nextElementSibling.showModal() const mapId = button.dataset.mapId - if (!document.querySelector(`#${mapId}_target`).hasChildNodes()) { + if (!document.querySelector(`#${mapId}_target`).children.length) { const previewSettings = JSON.parse(document.getElementById(mapId).textContent) const map = new U.Map(`${mapId}_target`, previewSettings) CACHE[mapId] = map