Comparing version 5.0.0 to 5.1.0
@@ -118,8 +118,14 @@ var events = require('./events') | ||
if (!newNode.hasAttributeNS(null, 'value') || newValue === 'null') { | ||
if (newValue !== oldValue) { | ||
oldNode.setAttribute('value', newValue) | ||
oldNode.value = newValue | ||
} | ||
if (newValue === 'null') { | ||
oldNode.value = '' | ||
oldNode.removeAttribute('value') | ||
} else if (newValue !== oldValue) { | ||
oldNode.setAttribute('value', newValue) | ||
oldNode.value = newValue | ||
} | ||
if (!newNode.hasAttributeNS(null, 'value')) { | ||
oldNode.removeAttribute('value') | ||
} else if (oldNode.type === 'range') { | ||
@@ -126,0 +132,0 @@ // this is so elements like slider move their UI thingy |
{ | ||
"name": "nanomorph", | ||
"version": "5.0.0", | ||
"version": "5.1.0", | ||
"description": "Hyper fast diffing algorithm for real DOM nodes", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
21
test.js
@@ -152,3 +152,3 @@ var seed = require('math-random-seed') | ||
t.test('if new tree has value and old tree does too, set value from new tree', function (t) { | ||
t.plan(1) | ||
t.plan(4) | ||
var a = html`<input type="text" value="howdy" />` | ||
@@ -158,2 +158,21 @@ var b = html`<input type="text" value="hi" />` | ||
t.equal(res.value, 'hi') | ||
a = html`<input type="text"/>` | ||
a.value = 'howdy' | ||
b = html`<input type="text"/>` | ||
b.value = 'hi' | ||
res = morph(a, b) | ||
t.equal(res.value, 'hi') | ||
a = html`<input type="text" value="howdy"/>` | ||
b = html`<input type="text"/>` | ||
b.value = 'hi' | ||
res = morph(a, b) | ||
t.equal(res.value, 'hi') | ||
a = html`<input type="text"/>` | ||
a.value = 'howdy' | ||
b = html`<input type="text" value="hi"/>` | ||
res = morph(a, b) | ||
t.equal(res.value, 'hi') | ||
}) | ||
@@ -160,0 +179,0 @@ }) |
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
27571
621