Text is always represented as text vnodes, never as vnode.text

This commit is contained in:
Barney Carroll 2021-04-14 17:06:32 +01:00 committed by Stephan Hoyer
parent 38e2184c6d
commit 9999fbe2a4
3 changed files with 86 additions and 72 deletions

View file

@ -32,13 +32,12 @@ function compileSelector(selector) {
function execSelector(state, vnode) {
var attrs = vnode.attrs
var children = Vnode.normalizeChildren(vnode.children)
var hasClass = hasOwn.call(attrs, "class")
var className = hasClass ? attrs.class : attrs.className
vnode.tag = state.tag
vnode.attrs = null
vnode.children = undefined
vnode.children = Vnode.normalizeChildren(vnode.children)
if (!isEmpty(state.attrs) && !isEmpty(attrs)) {
var newAttrs = {}
@ -73,12 +72,6 @@ function execSelector(state, vnode) {
}
}
if (Array.isArray(children) && children.length === 1 && children[0] != null && children[0].tag === "#") {
vnode.text = children[0].children
} else {
vnode.children = children
}
return vnode
}