🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

nanomorph

Package Overview
Dependencies
Maintainers
29
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nanomorph - npm Package Compare versions

Comparing version

to
5.4.1

6

lib/morph.js

@@ -120,2 +120,8 @@ var events = require('./events')

// The "indeterminate" property can not be set using an HTML attribute.
// See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox
if (newNode.indeterminate !== oldNode.indeterminate) {
oldNode.indeterminate = newNode.indeterminate
}
if (newValue !== oldValue) {

@@ -122,0 +128,0 @@ oldNode.setAttribute('value', newValue)

8

package.json
{
"name": "nanomorph",
"version": "5.4.0",
"version": "5.4.1",
"description": "Hyper fast diffing algorithm for real DOM nodes",

@@ -32,3 +32,3 @@ "main": "index.js",

"bankai": "^7.6.2",
"browserify": "^14.1.0",
"browserify": "^16.5.0",
"dependency-check": "^2.5.1",

@@ -38,5 +38,5 @@ "math-random-seed": "^1.0.0",

"standard": "^10.0.3",
"tape": "^4.10.0",
"tape-run": "^3.0.0"
"tape": "^4.13.0",
"tape-run": "^6.0.1"
}
}

@@ -171,2 +171,78 @@ var tape = require('tape')

function booleanPropertyTest (property) {
return function (t) {
t.test(`if new tree has no ${property} and old tree does, remove value`, function (t) {
t.plan(1)
var a = html`<input type="checkbox" ${property}=${true} />`
var b = html`<input type="checkbox" />`
var res = morph(a, b)
t.equal(res[property], false)
})
t.test(`if new tree has ${property} and old tree does not, add value`, function (t) {
t.plan(1)
var a = html`<input type="checkbox" />`
var b = html`<input type="checkbox" ${property}=${true} />`
var res = morph(a, b)
t.equal(res[property], true)
})
t.test(`if new tree has ${property} and old tree does too, set value from new tree`, function (t) {
t.plan(6)
var a = html`<input type="checkbox" ${property}=${false} />`
var b = html`<input type="checkbox" ${property}=${true} />`
var res = morph(a, b)
t.equal(res[property], true)
a = html`<input type="checkbox" ${property}=${true} />`
b = html`<input type="checkbox" ${property}=${false} />`
res = morph(a, b)
t.equal(res[property], false)
a = html`<input type="checkbox"/>`
b = html`<input type="checkbox"/>`
b[property] = true
res = morph(a, b)
t.equal(res[property], true)
a = html`<input type="checkbox" ${property}=${false}/>`
b = html`<input type="checkbox"/>`
b[property] = true
res = morph(a, b)
t.equal(res[property], true)
a = html`<input type="checkbox" ${property}=${true}/>`
b = html`<input type="checkbox"/>`
b[property] = false
res = morph(a, b)
t.equal(res[property], false)
a = html`<input type="checkbox"/>`
b = html`<input type="checkbox" ${property}=${true}/>`
res = morph(a, b)
t.equal(res[property], true)
})
t.end()
}
}
t.test('checked', booleanPropertyTest('checked'))
t.test('disabled', booleanPropertyTest('disabled'))
t.test('indeterminate', function (t) {
t.plan(2)
var a = html`<input type="checkbox"/>`
var b = html`<input type="checkbox"/>`
b.indeterminate = true
var res = morph(a, b)
t.equal(res.indeterminate, true)
a = html`<input type="checkbox"/>`
b = html`<input type="checkbox"/>`
a.indeterminate = true
res = morph(a, b)
t.equal(res.indeterminate, false)
})
t.test('isSameNode', function (t) {

@@ -173,0 +249,0 @@ t.test('should return a if true', function (t) {

Sorry, the diff of this file is not supported yet