diff options
Diffstat (limited to 'frontend/helper.ts')
-rw-r--r-- | frontend/helper.ts | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/frontend/helper.ts b/frontend/helper.ts index 2ecfc35..6e7ca5c 100644 --- a/frontend/helper.ts +++ b/frontend/helper.ts @@ -17,7 +17,7 @@ function apply_opts<E extends HTMLElement>(e: E, o: Opts<E>) { if (o.onchange) e.onchange = () => o.onchange!(e) if (o.for) (e as unknown as HTMLLabelElement).htmlFor = o.for if (o.type && e instanceof HTMLInputElement) e.type = o.type - if (o.href && e instanceof HTMLAnchorElement) e.href = o.href; + if (o.href && e instanceof HTMLAnchorElement) e.href = o.href if (typeof o?.class == "string") e.classList.add(o.class) if (typeof o?.class == "object") e.classList.add(...o.class) } @@ -26,7 +26,7 @@ export function e<K extends keyof HTMLElementTagNameMap>(name: K, opts: Opts<HTM const el = document.createElement(name) apply_opts(el, opts) for (const c of children) { - if (typeof c == "string") el.textContent += c; + if (typeof c == "string") el.textContent += c else el.append(c) } return el |