Skip to content

Commit

Permalink
add check in diff/hydrate when both oldVNode/node and vnode are null
Browse files Browse the repository at this point in the history
  • Loading branch information
kbrsh committed Apr 15, 2017
1 parent 3b5558e commit 5b029b0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
8 changes: 6 additions & 2 deletions dist/moon.js
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,9 @@
var hydrate = function (node, vnode, parent, instance) {
var nodeName = node ? node.nodeName.toLowerCase() : null;

if (node === null) {
if (node === null && vnode === null) {
return null;
} else if (node === null) {
// No node, create one
var newNode = createNodeFromVNode(vnode, instance);
appendChild(newNode, vnode, parent);
Expand Down Expand Up @@ -741,7 +743,9 @@
* @return {Number} patch type
*/
var diff = function (oldVNode, vnode, parent, instance) {
if (oldVNode === null) {
if (oldVNode === null && vnode === null) {
return PATCH.SKIP;
} else if (oldVNode === null) {
// No Node, append a node
appendChild(createNodeFromVNode(vnode, instance), vnode, parent);

Expand Down
Loading

0 comments on commit 5b029b0

Please sign in to comment.