diff options
Diffstat (limited to 'static/lib.ts')
-rw-r--r-- | static/lib.ts | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/static/lib.ts b/static/lib.ts index bc072545..2ef5b596 100644 --- a/static/lib.ts +++ b/static/lib.ts @@ -120,11 +120,14 @@ function to_local(date: Date): Date { /* -------------------------------------------------- */ -function makeElement(name: string, attr = {}): HTMLElement { +function makeElement(name: string, attr = {}, actualAttr = {}): HTMLElement { let element: HTMLElement = document.createElement(name); for (let [key, value] of Object.entries(attr)) { (element as any)[key] = value; } + for (let [key, value] of Object.entries(actualAttr)) { + element.setAttribute(key, '' + value); + } return element; } |