bundle
This commit is contained in:
14
js/elemwrapper.js
Normal file
14
js/elemwrapper.js
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user