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.6.0 to 0.6.1

4

find.js
module.exports = function find(start, test, until) { //find(test, head=body, foot=null)
var spot = start.node || start,
last = until ? (until.node || until) : null
var spot = start,
last = until || null
while(!test(spot)) {

@@ -5,0 +5,0 @@ if (spot === last) return null // specified end reached

// @ts-check
/* eslint-disable global-require */
module.exports = {
update: require('./update'),
updateChildren: require('./update-children'),
el: require('./el'),
svg: require('./svg'),
list: require('./list'),
find: require('./find'),
mount: require('./mount'),
css: require('./css')
update: require('./update'),
updateChildren: require('./update-children')
}

@@ -56,3 +56,2 @@ var core = require('./core')

var updt = kid._$uK
//TODO does not work for nested lists
if (updt) updt(kid, arr[i], key, arr)

@@ -64,5 +63,3 @@ }

//place kid
//TODO does not work for nested lists
if (!spot) kin.appendChild(kid)
else if (kid === spot.nextSibling) kin.insertBefore(spot, list.tail)
if (kid === spot.nextSibling) kin.insertBefore(spot, list.tail)
else if (kid !== spot) kin.insertBefore(kid, spot)

@@ -69,0 +66,0 @@ spot = kid.nextSibling

@@ -14,14 +14,16 @@ var core = require('./core')

}
if (kid.constructor === String) return kin.appendChild(core.document.createTextNode(kid))
if (kid.constructor === Number) return kin.appendChild(core.document.createTextNode(''+kid))
if (kid.nodeType === 8) {
var list = kid._$lK
if (list) {
kin.appendChild(kid)
return kin.appendChild(list.tail)
var typ = kid.nodeType
if (typ) {
if (typ === 8) {
//list node
var list = kid._$lK
if (list) {
kin.appendChild(kid)
return kin.appendChild(list.tail)
}
}
//normal node
return kin.appendChild(kid)
}
if (kid.nodeType) return kin.appendChild(kid)
throw Error('invalid child')
return kin.appendChild(core.document.createTextNode(''+kid))
}
{
"name": "attodom",
"version": "0.6.0",
"version": "0.6.1",
"main": "./index.js",

@@ -17,3 +17,3 @@ "description": "yet another small DOM component library",

"@hugov/cjs-to-iife": "^0.1.1",
"@types/node": "^8.5.1",
"@types/node": "^10.5.2",
"cotest": "^2.1.1"

@@ -20,0 +20,0 @@ },

@@ -21,4 +21,6 @@ # attodom

* no virtual DOM, all operations are done on actual nodes
* 1 kb gzip, no dependencies
* Designed for older browsers, low memory requirement and no transpilation required
* less than 1kb gzip, no dependencies
* Designed for phones and/or older browsers:
* very low memory requirement
* no transpilation required

@@ -28,5 +30,3 @@

* view and event helpers only
* limited css utility
* strictly DOM element creation and manipulation (no router, no store)
* strictly DOM element creation and manipulations (no router, no store)

@@ -64,5 +64,5 @@

list creates a `Comment Node` that will be followed by a variable number of Nodes upon update with an array.
`list` creates a `Comment Node` that will be followed by a variable number of Nodes upon update with an array.
A list can't contain another list
### Server use

@@ -73,4 +73,4 @@

```javascript
const root = require('attodom/root')
root.document = myDocumentObject
const core = require('attodom/core')
core.document = myDocumentObject
```

@@ -77,0 +77,0 @@

var ct = require('cotest'),
el = require('../el'),
update = require('../update'),
updateChildren = require('../update-children'),
el = require('../').el,
update = require('../').update,
updateChildren = require('../').updateChildren,
root = require('../core'),

@@ -6,0 +6,0 @@ JSDOM = require('jsdom').JSDOM

var ct = require('cotest'),
el = require('../el'),
ls = require('../list'),
el = require('../').el,
ls = require('../').list,
core = require('../core'),
update = require('../update'),
updateChildren = require('../update-children'),
update = require('../').update,
updateChildren = require('../').updateChildren,
JSDOM = require('jsdom').JSDOM

@@ -76,11 +76,1 @@

})
ct.skip('list nested', function() {
//TODO fix consistent mounting in list update
var kin = el('div', ls(function() {return ls(upperKid)}), updateChildren)
ct('===', toString(kin.childNodes), '')
update(kin, [['a']], null, null)
ct('===', toString(kin.childNodes), 'a')
//update(kin, [['a', 'b']], null, null)
//ct('===', toString(kin.childNodes), 'aB$aBaB')
})

@@ -12,4 +12,4 @@ var update = require('./update')

var spot = kin.firstChild
while (spot) spot = update(spot, val, key, obj).nextSibling
while ((spot = update(spot, val, key, obj).nextSibling));
return kin
}
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