feat: Return empty string node for false values
Very specifically doing a strict `false` check here to try & avoid coercion perf costs.
This commit is contained in:
parent
baa630f2a6
commit
6170573c29
1 changed files with 1 additions and 1 deletions
|
|
@ -3,7 +3,7 @@ function Vnode(tag, key, attrs, children, text, dom) {
|
||||||
}
|
}
|
||||||
Vnode.normalize = function(node) {
|
Vnode.normalize = function(node) {
|
||||||
if (Array.isArray(node)) return Vnode("[", undefined, undefined, Vnode.normalizeChildren(node), undefined, undefined)
|
if (Array.isArray(node)) return Vnode("[", undefined, undefined, Vnode.normalizeChildren(node), undefined, undefined)
|
||||||
if (node != null && typeof node !== "object") return Vnode("#", undefined, undefined, node, undefined, undefined)
|
if (node != null && typeof node !== "object") return Vnode("#", undefined, undefined, node === false ? "" : node, undefined, undefined)
|
||||||
return node
|
return node
|
||||||
}
|
}
|
||||||
Vnode.normalizeChildren = function normalizeChildren(children) {
|
Vnode.normalizeChildren = function normalizeChildren(children) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue