Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

virtual-dom

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

virtual-dom - npm Package Compare versions

Comparing version 0.0.20 to 0.0.21

12

package.json
{
"name": "virtual-dom",
"version": "0.0.20",
"version": "0.0.21",
"description": "A batched diff-based DOM rendering strategy",

@@ -22,4 +22,4 @@ "keywords": [],

"is-object": "0.1.2",
"vdom": "0.0.20",
"vtree": "0.0.20",
"vdom": "0.0.21",
"vtree": "0.0.21",
"x-is-array": "0.1.0",

@@ -47,8 +47,8 @@ "x-is-string": "0.1.0"

"start": "node ./index.js",
"cover": "istanbul cover --report none --print detail ./test/index.js",
"view-cover": "istanbul report html && google-chrome ./coverage/index.html",
"cover": "istanbul cover --no-default-excludes -x **/node_modules/vtree/node_modues/** -x **/node_modules/vdom/node_modules/** -x **/node_modules/b*/* -x **/node_modules/g*/* -x **/node_modules/i*/** -x **/node_modules/m*/** -x **/node_modules/r*/** -x **/node_modules/t*/** -x **/node_modules/x*/** -x **/node_modules/z*/** -x **/test/** -x **/tests/** --report none --print detail ./test/index.js",
"view-cover": "istanbul report html && open ./coverage/index.html",
"browser": "run-browser test/index.js",
"phantom": "run-browser test/index.js -b | tap-spec",
"dist": "browserify --standalone virtual-dom index.js > dist/virtual-dom.js",
"travis-test": "npm run phantom && npm run cover && istanbul report lcov && ((cat coverage/lcov.info | coveralls) || exit 0) && zuul -- test/index.js"
"travis-test": "npm run phantom && npm run cover && istanbul report lcov && ((cat coverage/lcov.info | coveralls) || exit 0)"
},

@@ -55,0 +55,0 @@ "testling": {

@@ -9,1 +9,3 @@ require("./main.js")

require("./attributes")
require('vdom/test/dom-index')
require('vtree/test/handle-thunk')

@@ -346,3 +346,3 @@ var test = require("tape")

h("div", { key: "c" }, "c"),
h("div", { key: "d" }, "d"),
h("div", { key: "d" }, "d")
])

@@ -349,0 +349,0 @@

@@ -24,3 +24,4 @@ module.exports = assertEqualDom

key !== "outerHTML" &&
key !== "innerHTML"
key !== "innerHTML" &&
"" + parseInt(key, 10) !== key
) {

@@ -27,0 +28,0 @@ if (key === "ownerDocument") {

@@ -622,2 +622,59 @@ var test = require("tape")

test("Ensure children are not rendered more than once", function (assert) {
var initCount = 0
var updateCount = 0
var rightState = { a: 1 }
var domNode
function Widget(state) {
this.state = state
this.vdom = this.render(state)
}
Widget.prototype.init = function () {
initCount++
return render(this.vdom)
}
Widget.prototype.update = function (leftNode, dom) {
updateCount++
patch(dom, diff(leftNode.vdom, this.vdom))
}
Widget.prototype.render = function (state) {
return h("div", "" + state.a)
}
Widget.prototype.type = "Widget"
var rightWidget = new Widget(rightState)
var leftTree = h("div.container", [
h("div")
])
var rightTree = h("div.container", [
h("section.widgetContainer", rightWidget)
])
domNode = render(leftTree)
assert.equal(initCount, 0, "initCount after left render")
assert.equal(updateCount, 0, "updateCount after left render")
var patches = diff(leftTree, rightTree)
assert.equal(patchCount(patches), 1)
assert.equal(initCount, 0, "initCount after diff")
assert.equal(updateCount, 0, "updateCount after diff")
var newRoot = patch(domNode, patches)
assert.equal(initCount, 1, "initCount after patch")
assert.equal(updateCount, 0, "updateCount after patch")
// The patch should only update sibling value in this use case
var expectedNode = render(rightTree)
assert.equal(newRoot, domNode)
assertEqualDom(assert, newRoot, expectedNode)
assert.end()
})
test("VNode indicates stateful sibling", function (assert) {

@@ -775,2 +832,7 @@ var statefulWidget = {

test("Create element respects namespace", function (assert) {
if (!supportsNamespace()) {
assert.skip("browser doesn't support namespaces");
return assert.end();
}
var svgURI = "http://www.w3.org/2000/svg"

@@ -786,2 +848,7 @@ var vnode = new Node("svg", {}, [], null, svgURI)

test("Different namespaces creates a patch", function (assert) {
if (!supportsNamespace()) {
assert.skip("browser doesn't support namespaces");
return assert.end();
}
var leftNode = new Node("div", {}, [], null, "testing")

@@ -811,1 +878,8 @@ var rightNode = new Node("div", {}, [], null, "undefined")

}
// Determine if namespace is supported by the DOM
function supportsNamespace() {
var node = render(h())
return 'namespaceURI' in node;
}

@@ -86,3 +86,3 @@ var test = require("tape")

newRoot = patch(rootNode, diff(leftNode, rightNode))
var newRoot = patch(rootNode, diff(leftNode, rightNode))
assert.equal(newRoot.special, null)

@@ -89,0 +89,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc