Why not use Node.nodeType for checking nodeType equality in htmldomapi.ts ?
Fujihai opened this issue · comments
In snabbdom\src\htmldomapi.ts,I think use Node.nodeType for checking nodeType equality is better.
Browser compatibility
https://caniuse.com/?search=node.nodeType
Usage
before:
function isElement(node: Node): node is Element {
return node.nodeType === 1;
}
function isText(node: Node): node is Text {
return node.nodeType === 3;
}
function isComment(node: Node): node is Comment {
return node.nodeType === 8;
}
function isDocumentFragment(node: Node): node is DocumentFragment {
return node.nodeType === 11;
}
after:
function isElement(node: Node): node is Element {
return node.nodeType === Node.ELEMENT_NODE;
}
function isText(node: Node): node is Text {
return node.nodeType === Node.TEXT_NODE;
}
function isComment(node: Node): node is Comment {
return node.nodeType === Node.COMMENT_NODE;
}
function isDocumentFragment(node: Node): node is DocumentFragment {
return node.nodeType === Node.DOCUMENT_FRAGMENT_NODE;
}
I guess it would not make much of a difference. If you want to submit a PR I will merge it.
PR: #1024