aboutsummaryrefslogtreecommitdiff
path: root/frontend/helper.ts
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2023-08-14 18:22:38 +0200
committermetamuffin <metamuffin@disroot.org>2023-08-14 18:22:38 +0200
commit12cdf9bd11da1573bbfde4a0736090ed2fc3efde (patch)
tree679fae325f8ee3bb4d1e90b8021679a8a3b6a66f /frontend/helper.ts
parent44e16504a1605d1d00f202863935767326cd453c (diff)
downloadfastbangs-12cdf9bd11da1573bbfde4a0736090ed2fc3efde.tar
fastbangs-12cdf9bd11da1573bbfde4a0736090ed2fc3efde.tar.bz2
fastbangs-12cdf9bd11da1573bbfde4a0736090ed2fc3efde.tar.zst
fix type errors and small refactor
Diffstat (limited to 'frontend/helper.ts')
-rw-r--r--frontend/helper.ts4
1 files changed, 4 insertions, 0 deletions
diff --git a/frontend/helper.ts b/frontend/helper.ts
index 6e7ca5c..bfd57f0 100644
--- a/frontend/helper.ts
+++ b/frontend/helper.ts
@@ -4,6 +4,8 @@ interface Opts<E> {
class?: string[] | string,
id?: string,
src?: string,
+ rel?: string,
+ title?: string,
for?: string,
type?: string,
href?: string,
@@ -18,6 +20,8 @@ function apply_opts<E extends HTMLElement>(e: E, o: Opts<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.rel && e instanceof HTMLAnchorElement) e.rel = o.rel
+ if (o.title && e instanceof HTMLAnchorElement) e.title = o.title
if (typeof o?.class == "string") e.classList.add(o.class)
if (typeof o?.class == "object") e.classList.add(...o.class)
}