Skip to content

caub/dom-tagged-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DOM helper to create elements/fragments similarly to jsx

Build Status

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>
`;

live example

About

Tagged template function for DOM building

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published