Created
June 21, 2020 06:45
-
-
Save drawcode/b7748f22e8552ae1f8fcbd6571a9b83e to your computer and use it in GitHub Desktop.
jssimple.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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