Skip to content

Instantly share code, notes, and snippets.

@drawcode
Created June 21, 2020 06:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drawcode/b7748f22e8552ae1f8fcbd6571a9b83e to your computer and use it in GitHub Desktop.
Save drawcode/b7748f22e8552ae1f8fcbd6571a9b83e to your computer and use it in GitHub Desktop.
jssimple.js
const $T = text => document.createTextNode(text)
function $E(tag, props, kids) {
const elem = document.createElement(tag)
for (const k in props) {
elem[k] = props[k]
}
for (const kid of kids) {
elem.appendChild(kid)
}
return elem
}
const button = $E('button', {}, [
$E('i', {className: 'icon-lightbulb'}, []),
$T('I learned something!'),
$E('object', {data: '/confetti.svg', width: 30, height: 30}, []),
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment