Package Exports
- h3
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (h3) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
h3-js
A better HTMLElement constructor
Example
var body = h('div', 'example',
h('h1', null, 'Example'),
h('label', {htmlFor: 'task'},
h('input', {id: 'task', type: 'checkbox', checked: true}),
'Check out h3-js'
)
);
API
h(tagName, props, ...children)
Creates and returns a new HTMLElement.
Primary interface: tagName
sets the tag name, each key-value pair of props
is copied onto the result, and each of children
is appended to the result.
Conveniences:
props.style
setsresult.style.cssText
- If
props
is falsy then it is ignored - If
props
is a string then it instead setsresult.className
- Children that are falsy are ignored
- Children that are strings are converted to
Text
instances - Children that are Arrays are flattened into
children
Setup
Install: npm install h3
Import: const h = require('h3');