This commit is contained in:
Gleb A. 2025-05-31 16:45:28 +07:00 committed by GitHub
commit 22a59ffb5c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -32,9 +32,11 @@ function buildIdToNavigationElementMap(navigation: NodeListOf<Element>): IdToEle
const sectionLinkRef: IdToElementMap = {}; const sectionLinkRef: IdToElementMap = {};
navigation.forEach((navigationElement: HTMLElement) => { navigation.forEach((navigationElement: HTMLElement) => {
const link = navigationElement.querySelector("a"); const link = navigationElement.querySelector("a");
const href = link.getAttribute("href"); if (link) {
if (href.startsWith("#")) { const href = link.getAttribute("href");
sectionLinkRef[href.slice(1)] = navigationElement; if (href.startsWith("#")) {
sectionLinkRef[href.slice(1)] = navigationElement;
}
} }
}); });