Comparing version 5.1.1 to 5.1.2
60
index.js
@@ -5,3 +5,3 @@ var assert = require('assert') | ||
var TEXT_NODE = 3 | ||
var DEBUG = false | ||
// var DEBUG = false | ||
@@ -24,13 +24,13 @@ module.exports = nanomorph | ||
function nanomorph (oldTree, newTree) { | ||
if (DEBUG) { | ||
console.log( | ||
'nanomorph\nold\n %s\nnew\n %s', | ||
oldTree && oldTree.outerHTML, | ||
newTree && newTree.outerHTML | ||
) | ||
} | ||
// if (DEBUG) { | ||
// console.log( | ||
// 'nanomorph\nold\n %s\nnew\n %s', | ||
// oldTree && oldTree.outerHTML, | ||
// newTree && newTree.outerHTML | ||
// ) | ||
// } | ||
assert.equal(typeof oldTree, 'object', 'nanomorph: oldTree should be an object') | ||
assert.equal(typeof newTree, 'object', 'nanomorph: newTree should be an object') | ||
var tree = walk(newTree, oldTree) | ||
if (DEBUG) console.log('=> morphed\n %s', tree.outerHTML) | ||
// if (DEBUG) console.log('=> morphed\n %s', tree.outerHTML) | ||
return tree | ||
@@ -41,9 +41,9 @@ } | ||
function walk (newNode, oldNode) { | ||
if (DEBUG) { | ||
console.log( | ||
'walk\nold\n %s\nnew\n %s', | ||
oldNode && oldNode.outerHTML, | ||
newNode && newNode.outerHTML | ||
) | ||
} | ||
// if (DEBUG) { | ||
// console.log( | ||
// 'walk\nold\n %s\nnew\n %s', | ||
// oldNode && oldNode.outerHTML, | ||
// newNode && newNode.outerHTML | ||
// ) | ||
// } | ||
if (!oldNode) { | ||
@@ -67,9 +67,9 @@ return newNode | ||
function updateChildren (newNode, oldNode) { | ||
if (DEBUG) { | ||
console.log( | ||
'updateChildren\nold\n %s\nnew\n %s', | ||
oldNode && oldNode.outerHTML, | ||
newNode && newNode.outerHTML | ||
) | ||
} | ||
// if (DEBUG) { | ||
// console.log( | ||
// 'updateChildren\nold\n %s\nnew\n %s', | ||
// oldNode && oldNode.outerHTML, | ||
// newNode && newNode.outerHTML | ||
// ) | ||
// } | ||
var oldChild, newChild, morphed, oldMatch | ||
@@ -83,9 +83,9 @@ | ||
newChild = newNode.childNodes[i - offset] | ||
if (DEBUG) { | ||
console.log( | ||
'===\n- old\n %s\n- new\n %s', | ||
oldChild && oldChild.outerHTML, | ||
newChild && newChild.outerHTML | ||
) | ||
} | ||
// if (DEBUG) { | ||
// console.log( | ||
// '===\n- old\n %s\n- new\n %s', | ||
// oldChild && oldChild.outerHTML, | ||
// newChild && newChild.outerHTML | ||
// ) | ||
// } | ||
// Both nodes are empty, do nothing | ||
@@ -92,0 +92,0 @@ if (!oldChild && !newChild) { |
{ | ||
"name": "nanomorph", | ||
"version": "5.1.1", | ||
"version": "5.1.2", | ||
"description": "Hyper fast diffing algorithm for real DOM nodes", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
33122
0