This commit is contained in:
Ian Gulliver
2024-12-21 07:26:27 -08:00
parent 4dc3675dbd
commit 1c90c313f0
9 changed files with 77 additions and 68 deletions

14
js/elemwrapper.js Normal file
View File

@@ -0,0 +1,14 @@
export class ElemWrapper {
elem;
constructor(elem) {
this.elem = elem;
}
add(name, ...attrs) {
const elem = document.createElement(name);
this.elem.appendChild(elem);
for (let i = 0; i < attrs.length; i += 2) {
elem.setAttribute(attrs[i], attrs[i + 1]);
}
return new ElemWrapper(elem);
}
}