diff options
author | Hsieh Chin Fan <pham@topo.tw> | 2024-10-15 19:59:20 +0800 |
---|---|---|
committer | Hsieh Chin Fan <pham@topo.tw> | 2024-10-15 20:00:54 +0800 |
commit | d78e35052aa136348cc1d91ec45d00ec347730a5 (patch) | |
tree | 03461a1721a506469f2119380e76042587c589ea | |
parent | d242a9608fa7175a46be39853f379c76fe9e0c01 (diff) |
fix: in case anchor element has no property href
-rw-r--r-- | src/dumbymap.mjs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/dumbymap.mjs b/src/dumbymap.mjs index 4d1a2ed..fb89d61 100644 --- a/src/dumbymap.mjs +++ b/src/dumbymap.mjs | |||
@@ -165,7 +165,7 @@ export const generateMaps = (container, { | |||
165 | /** LINK: Add external symbol on anchors */ | 165 | /** LINK: Add external symbol on anchors */ |
166 | container.querySelectorAll('a') | 166 | container.querySelectorAll('a') |
167 | .forEach(a => { | 167 | .forEach(a => { |
168 | if (a.href.startsWith('http') && !a.href.startsWith(window.location.origin)) { | 168 | if (typeof a.href === 'string' && a.href.startsWith('http') && !a.href.startsWith(window.location.origin)) { |
169 | a.classList.add('external') | 169 | a.classList.add('external') |
170 | } | 170 | } |
171 | }) | 171 | }) |