Skip to content

Commit 2ac158f

Browse files
committed
fix: resolve TS18048 type error
1 parent 29d6a7c commit 2ac158f

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

lib/index.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,10 @@ function startTag(node, state) {
510510
resetTokenizer(state, pointStart(node))
511511

512512
const current = state.parser.openElements.current
513-
let ns = 'namespaceURI' in current ? current.namespaceURI : webNamespaces.html
513+
let ns =
514+
current && 'namespaceURI' in current
515+
? current.namespaceURI
516+
: webNamespaces.html
514517

515518
if (ns === webNamespaces.html && tagName === 'svg') {
516519
ns = webNamespaces.svg
@@ -633,8 +636,8 @@ function documentMode(node) {
633636
const head = node.type === 'root' ? node.children[0] : node
634637
return Boolean(
635638
head &&
636-
(head.type === 'doctype' ||
637-
(head.type === 'element' && head.tagName.toLowerCase() === 'html'))
639+
(head.type === 'doctype' ||
640+
(head.type === 'element' && head.tagName.toLowerCase() === 'html'))
638641
)
639642
}
640643

0 commit comments

Comments
 (0)