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:
Pat Cavit 2017-01-05 23:07:34 -08:00
parent baa630f2a6
commit 6170573c29

View file

@ -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) {