Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/semibran/h
Create virtual DOM nodes
https://github.com/semibran/h
create dom h html nodes virtual
Last synced: about 2 months ago
JSON representation
Create virtual DOM nodes
- Host: GitHub
- URL: https://github.com/semibran/h
- Owner: semibran
- License: mit
- Created: 2017-09-26T17:42:11.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-11-26T07:58:58.000Z (about 7 years ago)
- Last Synced: 2024-11-01T07:24:28.773Z (3 months ago)
- Topics: create, dom, h, html, nodes, virtual
- Language: JavaScript
- Size: 2.93 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# h
> Create virtual DOM nodes## usage
`h` uses the standard `h(tag, attributes, children)` signature. Note that `children`, if provided, is always an array to minimize type checks:
```js
> h("div", { class: "foo" }, [ "hello world" ])
{
tag: "div",
attributes: { class: "foo" },
children: [ "hello world" ]
}
````attributes` defaults to an empty object and thus can be omitted.
```js
> h("h1", [ "title" ])
{
tag: "h1",
attributes: {},
children: [ "title" ]
}
```The same principle applies to `children`, except with an empty array.
```js
> h("br")
{
tag: "br",
attributes: {},
children: []
}
```## see also
- [`semibran/manifest`](https://github.com/semibran/manifest) - turn virtual DOM nodes into real DOM elements## license
[MIT](https://opensource.org/licenses/MIT) © [Brandon Semilla](https://git.io/semibran)