aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorHsieh Chin Fan <pham@topo.tw>2024-10-28 10:41:06 +0800
committerHsieh Chin Fan <pham@topo.tw>2024-10-28 12:24:12 +0800
commit1b387119cd06f7ccc20e7f5cd6715a57f79cbc1a (patch)
treee308b561f224722f17ce434d66a433ebbc70d009
parent069b1b74bbc369b3dddcd6fb2d64d77381ba0b17 (diff)
fix: initilization for blocks
-rw-r--r--src/dumbymap.mjs5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/dumbymap.mjs b/src/dumbymap.mjs
index 0d88f80..46a67a0 100644
--- a/src/dumbymap.mjs
+++ b/src/dumbymap.mjs
@@ -227,7 +227,7 @@ export const generateMaps = (container, {
227 new window.MutationObserver((mutations) => { 227 new window.MutationObserver((mutations) => {
228 for (const mutation of mutations) { 228 for (const mutation of mutations) {
229 const target = mutation.target 229 const target = mutation.target
230 if (target.matches?.('.mapclay') || target.closest?.('.mapclay')) return 230 if (target.matches?.('.mapclay') || target.closest?.('.mapclay')) continue
231 231
232 // In case observer triggered by data attribute 232 // In case observer triggered by data attribute
233 if (mutation.type === 'attribute') { 233 if (mutation.type === 'attribute') {
@@ -235,8 +235,7 @@ export const generateMaps = (container, {
235 } 235 }
236 236
237 // Update dumby block 237 // Update dumby block
238 const dumbyBlockChanges = [...mutation.addedNodes, ...mutation.removedNodes] 238 const dumbyBlockChanges = target.querySelectorAll('.dumby-block')
239 .find(node => node.classList?.contains('dumby-block'))
240 if (dumbyBlockChanges) { 239 if (dumbyBlockChanges) {
241 const blocks = container.querySelectorAll('.dumby-block') 240 const blocks = container.querySelectorAll('.dumby-block')
242 blocks.forEach(b => { 241 blocks.forEach(b => {