Files
tiny-worlds/web/dom.mjs
T

12 lines
343 B
JavaScript
Raw Normal View History

// web/dom.mjs — the two DOM helpers everything else builds on.
export const $ = (id) => document.getElementById(id);
// one element, class and text in the common shape
export function el(tag, cls, text) {
const e = document.createElement(tag);
if (cls) e.className = cls;
if (text !== undefined) e.textContent = text;
return e;
}