aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorHsieh Chin Fan <pham@topo.tw>2024-09-30 15:19:58 +0800
committerHsieh Chin Fan <pham@topo.tw>2024-10-01 11:35:11 +0800
commit193ba872c455296bff55e5f6a7d6dbbbb85c265e (patch)
treeb8ebc942676865f52b1d73e05796a82de080ba92 /src
parentcdd0f2bef5c522eb6809ba58d7d9adc2eb4bd6b3 (diff)
style: way to manage Element.children
Diffstat (limited to 'src')
-rw-r--r--src/MenuItem.mjs2
-rw-r--r--src/dumbymap.mjs2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/MenuItem.mjs b/src/MenuItem.mjs
index 9830bf4..f4cd518 100644
--- a/src/MenuItem.mjs
+++ b/src/MenuItem.mjs
@@ -150,7 +150,7 @@ export class Suggestion {
150 } 150 }
151 option.classList.add('container__suggestion'); 151 option.classList.add('container__suggestion');
152 option.onmouseover = () => { 152 option.onmouseover = () => {
153 Array.from(option.parentElement?.children ?? []).forEach(s => 153 Array.from(option.parentElement?.children)?.forEach(s =>
154 s.classList.remove('focus'), 154 s.classList.remove('focus'),
155 ); 155 );
156 option.classList.add('focus'); 156 option.classList.add('focus');
diff --git a/src/dumbymap.mjs b/src/dumbymap.mjs
index e0f9ecc..67376c7 100644
--- a/src/dumbymap.mjs
+++ b/src/dumbymap.mjs
@@ -91,7 +91,7 @@ export const createGeoLink = (link, callback = null) => {
91 91
92export const markdown2HTML = (container, mdContent) => { 92export const markdown2HTML = (container, mdContent) => {
93 // Render: Markdown -> HTML {{{ 93 // Render: Markdown -> HTML {{{
94 Array.from(container.children).map(e => e.remove()); 94 container.replaceChildren();
95 95
96 container.innerHTML = '<div class="SemanticHtml"></div>'; 96 container.innerHTML = '<div class="SemanticHtml"></div>';
97 const htmlHolder = container.querySelector('.SemanticHtml'); 97 const htmlHolder = container.querySelector('.SemanticHtml');