bundle
This commit is contained in:
14
ts/elemwrapper.ts
Normal file
14
ts/elemwrapper.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
export class ElemWrapper {
|
||||
constructor(private elem: HTMLElement) {}
|
||||
|
||||
add(name: string, ...attrs: string[]): ElemWrapper {
|
||||
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