summaryrefslogtreecommitdiffstats
path: root/web_src/js
diff options
context:
space:
mode:
Diffstat (limited to 'web_src/js')
-rw-r--r--web_src/js/markup/anchors.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/web_src/js/markup/anchors.js b/web_src/js/markup/anchors.js
index 03934ea215..6cf83eb428 100644
--- a/web_src/js/markup/anchors.js
+++ b/web_src/js/markup/anchors.js
@@ -39,7 +39,7 @@ export function initMarkupAnchors() {
if (!href.startsWith('#user-content-')) continue;
const originalId = href.replace(/^#user-content-/, '');
a.setAttribute('href', `#${encodeURIComponent(originalId)}`);
- if (document.getElementsByName(originalId).length !== 1) {
+ if (a.closest('.markup').querySelectorAll(`a[name="${originalId}"]`).length !== 1) {
a.addEventListener('click', (e) => {
scrollToAnchor(e.currentTarget.getAttribute('href'), false);
});