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

yet another small DOM component library

  • 0.6.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by50%
Maintainers
1
Weekly downloads
 
Created
Source

attodom

yet another experimental small DOM component library, <2kb

WhyAPILicense

Why

  • experimenting on different APIs to find the minimal helpers required for
    • dynamic nodes, elements and lists
    • one way data flow from root component to child nodes

Features

  • multiple dynamic lists within the same parent
  • svg and namespace support
  • ability to inject a document API for server use and/or testing (e.g. jsdom)
  • no virtual DOM, all operations are done on actual nodes
  • less than 1kb gzip, no dependencies
  • Designed for phones and/or older browsers:
    • very low memory requirement
    • no transpilation required

Limitations

  • strictly DOM element creation and manipulations (no router, no store)

API

Elements (hyperscript)

  • el(tagName [, attributes[, updater [,children]]] ): HTMLElement
  • svg(tagName [, attributes[, updater [,children]]] ): SVGElement

where attributes: {name: value} updater: function(Node, [*], [*], [*]):Node children: {number|string|Node|Array<children>}

Helper Function

update: function(Node, [*], [*], [*]):Node Updates a node with the provided updater defined on creation

updateChildren: function(ParentNode, [*], [*], [*]):ParentNode Updates all children nodes of a parenta node with the provided updater defined on creation

Lists

  • list(nodeFactory [, getKey]): CommentNode

where nodeFactory: function([*], [*], [*]): Node getKey: function([*], [number], [Array]): string

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

Document can be injected as follow:

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

License

MIT © Hugo Villeneuve

Keywords

FAQs

Package last updated on 22 Jul 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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