Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jamen/h2dom
Create DOM nodes using h functions
https://github.com/jamen/h2dom
dom dom-node h h2 h2spec html virtual-dom
Last synced: 25 days ago
JSON representation
Create DOM nodes using h functions
- Host: GitHub
- URL: https://github.com/jamen/h2dom
- Owner: jamen
- Created: 2017-06-11T03:01:59.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-02-24T19:24:33.000Z (almost 7 years ago)
- Last Synced: 2025-01-12T11:43:42.982Z (28 days ago)
- Topics: dom, dom-node, h, h2, h2spec, html, virtual-dom
- Language: JavaScript
- Homepage:
- Size: 9.77 KB
- Stars: 10
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# h2dom
> Create DOM nodes using h functions
_**NOTICE** This is not a patch function, it simply creates DOM nodes._
## Example
```js
var node = h('div', { class: 'foo' }, [
h('span', null, 'foo'),
' bar'
])document.body.appendChild(node)
```## Install
```
npm i h2dom
```## Usage
[This function follows the h2spec guidelines.](https://github.com/hyper2/h2spec)
### `h(tag, data?, children?)`
+ `tag`: the element name passed to `document.createElement(name)`
+ `data` (optional): an object containing the attributes to set on the element
+ `children` (optional): an array of DOM nodes or primitive values to be listed under `element.childNodes`