-
-
Save KOBA789/5283f3161938f2e82f4b753dba4e1544 to your computer and use it in GitHub Desktop.
e.js
This file contains 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
function E (tagName, attrs, children) { | |
const el = document.createElement(tagName); | |
attrs = attrs || {}; | |
Object.keys(attrs).forEach(function (key) { | |
el.setAttribute(key, attrs[key]); | |
}); | |
for (let child of children) { | |
if (child instanceof Node) { | |
el.appendChild(child); | |
} else { | |
el.appendChild(child.$elem); | |
} | |
} | |
return el; | |
} | |
function T (text) { | |
return document.createTextNode(text); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
LICENCE is CC0
https://misskey.io/notes/a04iau93jvoy0exf