12 lines
342 B
JavaScript
12 lines
342 B
JavaScript
// 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;
|
|
}
|