Skip to content

Commit 517d52f

Browse files
author
Matthew Brandt
committed
Add optional chaining and add "const" to heading_level declaration.
1 parent 33fd220 commit 517d52f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

doc/src/docs/assets/javascript/extra_js.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ document.querySelectorAll("section.print-page p:has(+ :is(h1, h2, h3, h4, h5, h6
2929
if (element.innerHTML !== '@nested-dl') return
3030

3131
let currentElement = element.nextElementSibling
32-
heading_level = currentElement.tagName.startsWith("H") ? currentElement.tagName : null
32+
const heading_level = currentElement?.tagName.startsWith("H") ? currentElement.tagName : null
3333

3434
if (!heading_level) return
3535

@@ -39,7 +39,7 @@ document.querySelectorAll("section.print-page p:has(+ :is(h1, h2, h3, h4, h5, h6
3939
}
4040

4141
currentElement = currentElement.nextElementSibling
42-
if (currentElement.tagName === heading_level) {
42+
if (currentElement?.tagName === heading_level) {
4343
break
4444
}
4545
}

0 commit comments

Comments
 (0)