Skip to content

Commit

Permalink
support creating components when replacing a child
Browse files Browse the repository at this point in the history
  • Loading branch information
kbrsh committed Feb 25, 2017
1 parent 7e40f0f commit 759ea23
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions dist/moon.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,10 @@
// Different types, replace it
var newNode = createNodeFromVNode(vnode, instance);
parent.replaceChild(newNode, node);
if (vnode.meta.component) {
// Detected parent component, build it here (parent node is available)
createComponentFromVNode(newNode, vnode, vnode.meta.component);
}
return newNode;
} else if (vnode.meta.shouldRender && vnode.type === "#text" && nodeName === "#text" && vnode.val !== node.textContent) {
// Both are textnodes, update the node
Expand Down
Loading

0 comments on commit 759ea23

Please sign in to comment.