chore(docs): missing type convert for nodes

This commit is contained in:
Neko Ayaka
2026-05-01 21:14:59 +08:00
parent af5ce6defb
commit bfb9d5cc74
+2 -4
View File
@@ -54,9 +54,7 @@ export function resolveTitle(theme: DefaultTheme.Config) {
}
export function getHeaders(range: DefaultTheme.Config['outline']) {
const headers = [
...document.querySelectorAll('article :where(h1,h2,h3,h4,h5,h6)'),
]
const headers = Array.from(document.querySelectorAll('article :where(h1,h2,h3,h4,h5,h6)'))
.filter(el => el.id && el.hasChildNodes())
.map((el) => {
const level = Number(el.tagName[1])
@@ -73,7 +71,7 @@ export function getHeaders(range: DefaultTheme.Config['outline']) {
function serializeHeader(h: Element): string {
let ret = ''
for (const node of h.childNodes) {
for (const node of Array.from(h.childNodes)) {
if (node.nodeType === 1) {
if (
(node as Element).classList.contains('VPBadge')