Skip to content

Commit

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

if (node === null && vnode === null) {
return null;
} else if (node === null) {
if (node === null) {
// No node, create one
var newNode = createNodeFromVNode(vnode, instance);
appendChild(newNode, vnode, parent);
Expand Down Expand Up @@ -735,17 +733,15 @@
};

/**
* Diffs Node and a VNode, and applies Changes
* @param {Object} node
* Diffs VNodes, and applies Changes
* @param {Object} oldVNode
* @param {Object} vnode
* @param {Object} parent
* @param {Object} instance
* @return {Number} patch type
*/
var diff = function (oldVNode, vnode, parent, instance) {
if (oldVNode === null && vnode === null) {
return PATCH.SKIP;
} else if (oldVNode === null) {
if (oldVNode === null) {
// No Node, append a node
appendChild(createNodeFromVNode(vnode, instance), vnode, parent);

Expand Down
Loading

0 comments on commit 5e21233

Please sign in to comment.