diff options
| author | Josh Kingsley <josh@joshkingsley.me> | 2025-10-26 14:28:55 +0200 |
|---|---|---|
| committer | Josh Kingsley <josh@joshkingsley.me> | 2025-10-26 14:28:55 +0200 |
| commit | 0324660a26684a5382b2c6c18cd0a4e9f0169631 (patch) | |
| tree | 64c16e8a4a4815f050f7e06a3b9486a668f2b4d4 /web/src/html.ts | |
| parent | 1b8d05bf83d7bd9ab425852f519ea81bdc379444 (diff) | |
feat(web): add dummy toolbar + tailwindcss colors
Diffstat (limited to 'web/src/html.ts')
| -rw-r--r-- | web/src/html.ts | 10 |
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()); |
