This small library offers a way to dynamically create HTML elements using tag names as functions.
Check the demonstration page to learn how it works.
- The library uses a
Proxy
, so the element functions are lazy loaded (on demand). - address the
className
property as{class: ...}
- address
data-attributes
as{data: {one: '...', ...}}
- address
innerHTML/textContent
as{html: ...}
or{text: ...}
- tag function names are case insensitive
(e.g.
tags.DIV
ortags.div
,const {h3, H3, DIV, p, P} = tags
)
Enjoy!
For a more comprehensive DOM helper, check my JQuery alike module (JQL).