summaryrefslogtreecommitdiff
path: root/web/src/html.ts
diff options
context:
space:
mode:
Diffstat (limited to 'web/src/html.ts')
-rw-r--r--web/src/html.ts10
1 files changed, 8 insertions, 2 deletions
diff --git a/web/src/html.ts b/web/src/html.ts
index 5bfff21..8802e50 100644
--- a/web/src/html.ts
+++ b/web/src/html.ts
@@ -13,8 +13,14 @@ const h = new Proxy({} as ElementCreator, {
(...args: any[]) => {
const el = document.createElement(tag);
- if (typeof args[0] === "object") {
- Object.assign(el, args.shift());
+ if (args[0]?.constructor === Object) {
+ const { dataset, ...attrs } = args.shift();
+
+ Object.assign(el, attrs);
+
+ if (dataset) {
+ Object.assign(el.dataset, dataset);
+ }
}
el.append(...args.flat());