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

attodom

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

attodom - npm Package Compare versions

Comparing version 0.5.1 to 0.5.2

8

co.js

@@ -111,5 +111,7 @@ var root = require('./root'),

var key = list.getKey(arr[i], i, arr),
comp = kids[key] = list.kids[key] || list.factory(arr[i], i, arr),
item = comp.node
if (comp.update) comp.update(arr[i], i, arr)
comp = list.kids[key]
if (!comp) comp = list.factory(arr[i], i, arr)
else if (comp.update) comp.update(arr[i], i, arr)
kids[key] = comp
var item = comp.node

@@ -116,0 +118,0 @@ if (!spot) node.appendChild(item)

{
"name": "attodom",
"version": "0.5.1",
"version": "0.5.2",
"main": "./index.js",

@@ -5,0 +5,0 @@ "description": "yet another small DOM component library",

@@ -19,4 +19,4 @@ var ct = require('cotest'),

function setText(t) { this.node.textContent = t }
function childFactory() {
return co(el('p', 'x'), {update: setText})
function childFactory(v) {
return co(el('p', v), {update: setText})
}

@@ -44,4 +44,4 @@ var comp = co(el('div'), '^', ls(childFactory), '$'),

var comp = co(el('h0'), ls(
function() {
return co(el('p'), 'x', {update: function(v) { this.node.textContent = v.v; this.update = null }})
function(val) {
return co(el('p', val.v), {update: function(v) { this.node.textContent = v.v }})
},

@@ -57,15 +57,9 @@ v => v.k

comp.update([{ k: 'b', v: 'bb' }, { k: 1, v: 11 }])
ct('===', toString(elem.childNodes), 'b1', 'must use existing nodes')
comp.update([{k: 'c', v:'c'}])
ct('===', toString(elem.childNodes), 'c')
comp.update([{ k: 'b', v: 'bbb' }, { k: 'c', v: 'ccc' }, { k: 1, v: 111 }])
ct('===', toString(elem.childNodes), 'bbbc111', 're-creates removed nodes')
})
ct('list - multiple', function() {
function childFactory() {
return co(el('p'))
function childFactory(v) {
return co(el('p', v))
}

@@ -72,0 +66,0 @@ var comp = co(el('div'), ls(childFactory), ls(childFactory)),

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