Fix keys, normalize holes (#2452)
* Fix #2434 * Treat holes as unkeyed, normalize boolean/null/undefined This brings a lot better consistency with that API, even though it's slightly breaking. (I had to update a bunch of tests to correspond with it.) * Fill in PR number [skip ci]
This commit is contained in:
parent
86d64e213f
commit
6c562d2b9b
12 changed files with 200 additions and 182 deletions
|
|
@ -5,8 +5,9 @@ function Vnode(tag, key, attrs, children, text, dom) {
|
|||
}
|
||||
Vnode.normalize = function(node) {
|
||||
if (Array.isArray(node)) return Vnode("[", undefined, undefined, Vnode.normalizeChildren(node), undefined, undefined)
|
||||
if (node != null && typeof node !== "object") return Vnode("#", undefined, undefined, node === false ? "" : node, undefined, undefined)
|
||||
return node
|
||||
if (node == null || typeof node === "boolean") return null
|
||||
if (typeof node === "object") return node
|
||||
return Vnode("#", undefined, undefined, String(node), undefined, undefined)
|
||||
}
|
||||
Vnode.normalizeChildren = function(input) {
|
||||
var children = []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue