dom-tagged-template
v1.2.1
Published
tagged template function for DOM building
Downloads
4
Maintainers
Readme
DOM helper to create elements/fragments similarly to jsx
const $ = require('dom-tagged-template');
const ul = $`<ul onClick=${e => {e.target.style.color=`hsl(${Math.floor(360*Math.random())},100%,50%)`}}>
${[1,2,3].map(x => $`<li>${x}</li>`)}
</ul>`.firstChild;
const div = $`<div>
<u onClick=${console.log}>Hello ${'!'.repeat(4)}</u>
${ul}
</div>`.firstChild;
const fragment = $`
<i>hello</i>
@
<br/>
<marquee>world</marquee>
`;