Let render() create the state rather than vnode()

This commit is contained in:
Pierre-Yves Gerardy 2017-03-08 22:08:16 +01:00
parent 1ffa4cf183
commit 74cbd4c17b
3 changed files with 9 additions and 3 deletions

View file

@ -21,6 +21,7 @@ module.exports = function($window) {
function createNode(parent, vnode, hooks, ns, nextSibling) {
var tag = vnode.tag
if (typeof tag === "string") {
vnode.state = {}
if (vnode.attrs != null) initLifecycle(vnode.attrs, vnode, hooks)
switch (tag) {
case "#": return createText(parent, vnode, nextSibling)
@ -238,7 +239,10 @@ module.exports = function($window) {
if (!recycling && shouldNotUpdate(vnode, old)) return
if (typeof oldTag === "string") {
if (vnode.attrs != null) {
if (recycling) initLifecycle(vnode.attrs, vnode, hooks)
if (recycling) {
vnode.state = {}
initLifecycle(vnode.attrs, vnode, hooks)
}
else updateLifecycle(vnode.attrs, vnode, hooks)
}
switch (oldTag) {