Simple utility to create HTML element by a string
npm install dohtml --save
const dom = require('dohtml');
const myElement = dom.create('<my-component></my-component>');
console.log(myElement);
dohtml
Kind: global variable
- dom :
Object
- .create(str) ⇒
Element
|Node
|null
- .isValidNode(el) ⇒
Boolean
- .render(target, els) ⇒
Element
|Node
|Error
- .create(str) ⇒
Create DOM element
Kind: static method of dom
Param | Description |
---|---|
str | html string or a single tag |
Check if is a valid Node
Kind: static method of dom
Param | Type |
---|---|
el | * |
Append multiple elements into target element
Kind: static method of dom
Param | Type |
---|---|
target | Element |
els | Array | Element |
You can view the changelog here
dohtml is open-sourced software licensed under the MIT license