Compact, fast, dependency-free function to use instead of
document.createElement
npm install --save makeelement
const makeElement = ;
It also creates a global variable makeElement
in non-CJS environment.
Usage
makeElement
accepts a tag name and its properties or properties object only which can include tagName
property (div
by default).
const element = ;
const element = ;
The function also allows to define attributes
, children
, style
and dataset
simultaneously. children
, in their turn, may include their own children
and its item can also be a DOM node.
const element = ;