nanomorph
Advanced tools
Comparing version
10
index.js
@@ -7,2 +7,6 @@ var assert = require('assert') | ||
function isProxy (node) { | ||
return node && node.dataset && node.dataset.proxy !== undefined | ||
} | ||
module.exports = nanomorph | ||
@@ -137,3 +141,7 @@ | ||
} else { | ||
oldNode.insertBefore(newChild, oldChild) | ||
if (isProxy(newChild) && !newChild.isSameNode(oldChild) && newChild.realNode) { | ||
oldNode.insertBefore(newChild.realNode, oldChild) | ||
} else { | ||
oldNode.insertBefore(newChild, oldChild) | ||
} | ||
offset++ | ||
@@ -140,0 +148,0 @@ } |
{ | ||
"name": "nanomorph", | ||
"version": "5.1.3", | ||
"version": "6.0.0-beta1", | ||
"description": "Hyper fast diffing algorithm for real DOM nodes", | ||
@@ -10,2 +10,3 @@ "main": "index.js", | ||
"test:fast": "browserify test/diff.js | tape-run", | ||
"test:proxy": "browserify test/proxy.js | tape-run", | ||
"start": "bankai start --debug test/diff.js" | ||
@@ -31,11 +32,11 @@ }, | ||
"devDependencies": { | ||
"bankai": "^7.6.2", | ||
"bel": "^5.1.1", | ||
"browserify": "^14.1.0", | ||
"bankai": "^9.8.0", | ||
"bel": "^5.1.7", | ||
"browserify": "^16.1.0", | ||
"dependency-check": "^2.5.1", | ||
"math-random-seed": "^1.0.0", | ||
"standard": "^10.0.3", | ||
"tape": "^4.6.0", | ||
"tape-run": "^3.0.0" | ||
"tape": "^4.9.0", | ||
"tape-run": "^3.0.4" | ||
} | ||
} |
@@ -92,29 +92,2 @@ var tape = require('tape') | ||
t.test('events', function (t) { | ||
t.test('should copy onclick events', function (t) { | ||
t.plan(1) | ||
var a = html`<button onclick=${fail}>OLD</button>` | ||
var b = html`<button>NEW</button>` | ||
var res = morph(a, b) | ||
res.click() | ||
a = html`<button>OLD</button>` | ||
b = html`<button onclick=${pass}>NEW</button>` | ||
res = morph(a, b) | ||
res.click() | ||
function fail (e) { | ||
e.preventDefault() | ||
t.fail('should not be called') | ||
} | ||
function pass (e) { | ||
e.preventDefault() | ||
t.ok('called') | ||
} | ||
}) | ||
}) | ||
t.test('values', function (t) { | ||
@@ -121,0 +94,0 @@ t.test('if new tree has no value and old tree does, remove value', function (t) { |
@@ -5,2 +5,3 @@ var tape = require('tape') | ||
var nanomorph = require('../') | ||
var abstractMorphEvents = require('./events') | ||
@@ -11,2 +12,3 @@ if (!module.parent) { | ||
abstractMorph(nanomorph) | ||
abstractMorphEvents(nanomorph) | ||
} else { | ||
@@ -13,0 +15,0 @@ module.exports = abstractMorph |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
84899
149.61%13
18.18%2253
180.22%0
-100%2
100%