Comparing version 0.3.2 to 0.3.3
@@ -12,3 +12,3 @@ function updateProps(oldVnode, vnode) { | ||
old = oldProps[key]; | ||
if (old !== cur) { | ||
if (old !== cur && (key !== 'value' || elm[key] !== cur)) { | ||
elm[key] = cur; | ||
@@ -15,0 +15,0 @@ } |
{ | ||
"name": "snabbdom", | ||
"version": "0.3.2", | ||
"version": "0.3.3", | ||
"description": "A virtual DOM library with focus on simplicity, modularity, powerful features and performance.", | ||
@@ -16,6 +16,10 @@ "main": "snabbdom.js", | ||
"knuth-shuffle": "^1.0.1", | ||
"testem": "^1.0.2" | ||
"testem": "^1.0.2", | ||
"xyz": "0.5.x" | ||
}, | ||
"scripts": { | ||
"test": "testem" | ||
"test": "testem", | ||
"release-major": "xyz --repo git@github.com:paldepind/snabbdom.git --increment major", | ||
"release-minor": "xyz --repo git@github.com:paldepind/snabbdom.git --increment minor", | ||
"release-patch": "xyz --repo git@github.com:paldepind/snabbdom.git --increment patch" | ||
}, | ||
@@ -22,0 +26,0 @@ "repository": { |
// jshint newcap: false | ||
/* global require, module, document, Element */ | ||
/* global require, module, document, Node */ | ||
'use strict'; | ||
@@ -198,5 +198,8 @@ | ||
} else if (isDef(ch)) { | ||
if (isDef(oldVnode.text)) elm.textContent = ''; | ||
addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue); | ||
} else if (isDef(oldCh)) { | ||
removeVnodes(elm, oldCh, 0, oldCh.length - 1); | ||
} else if (isDef(oldVnode.text)) { | ||
elm.textContent = ''; | ||
} | ||
@@ -215,3 +218,3 @@ } else if (oldVnode.text !== vnode.text) { | ||
for (i = 0; i < cbs.pre.length; ++i) cbs.pre[i](); | ||
if (oldVnode.nodeType === Element.ELEMENT_NODE) { | ||
if (oldVnode.nodeType === Node.ELEMENT_NODE) { | ||
if (oldVnode.parentElement !== null) { | ||
@@ -218,0 +221,0 @@ createElm(vnode, insertedVnodeQueue); |
@@ -451,2 +451,29 @@ var assert = require('assert'); | ||
}); | ||
it('removes a single text node', function() { | ||
var vnode1 = h('div', 'One'); | ||
var vnode2 = h('div'); | ||
patch(vnode0, vnode1); | ||
assert.equal(elm.textContent, 'One'); | ||
patch(vnode1, vnode2); | ||
assert.equal(elm.textContent, ''); | ||
}); | ||
it('removes a single text node when children are updated', function() { | ||
var vnode1 = h('div', 'One'); | ||
var vnode2 = h('div', [ h('div', 'Two'), h('span', 'Three') ]); | ||
patch(vnode0, vnode1); | ||
assert.equal(elm.textContent, 'One'); | ||
patch(vnode1, vnode2); | ||
console.log(elm.childNodes); | ||
assert.deepEqual(map(prop('textContent'), elm.childNodes), ['Two', 'Three']); | ||
}); | ||
it('removes a text node among other elements', function() { | ||
var vnode1 = h('div', [ 'One', h('span', 'Two') ]); | ||
var vnode2 = h('div', [ h('div', 'Three')]); | ||
patch(vnode0, vnode1); | ||
assert.deepEqual(map(prop('textContent'), elm.childNodes), ['One', 'Two']); | ||
patch(vnode1, vnode2); | ||
assert.equal(elm.childNodes.length, 1); | ||
assert.equal(elm.childNodes[0].tagName, 'DIV'); | ||
assert.equal(elm.childNodes[0].textContent, 'Three'); | ||
}); | ||
it('reorders elements', function() { | ||
@@ -453,0 +480,0 @@ var vnode1 = h('div', [h('span', 'One'), h('div', 'Two'), h('b', 'Three')]); |
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
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
305205
36
7575
6
10
2