Skip to content

voltraco/h

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

SYNOPSIS

Create dom elements using css syntax.

USAGE

npm install asyncly/h
const h = require('h')

Create a div element with the class foo.

h('.foo')
<div class="foo"></div>

Create an input element with the class foo.

h('input.foo')
<input class="foo">

Create an input with more classes

h('input.foo.bar')
<input class="foo bar">

Same as above but with an id (order is not important).

h('input#quxx.foo.bar')
<input id="quxx" class="foo bar">

Create an element with an attribute

h('span[x=y]')
<span x="y"></span>

Create an element with multiple attributes

h('span.foo[x=y][q=hello]')
<span class="foo" x="y" q="hello"></span>

Add child elements.

h('p', 'Hello, World!')
<p>Hello, World.</p>

Add as many child elements as you want, even more h.

const s = h('span.red', 'World')
h('p', 'Hello, ', s, '!')
<p>Hello, <span class="red">World</span>!</p>

About

Create dom elements using css syntax.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published