feat: add shared q() qs() DOM helpers

This commit is contained in:
2026-05-10 18:34:02 +02:00
parent eb0375ab1e
commit b2c9b99ab8

8
static/q.ts Normal file
View File

@@ -0,0 +1,8 @@
export const q = <T extends Element>(container: HTMLElement, selector: string): T | null =>
container.querySelector(selector) as T | null
export const qs = <T extends Element>(selector: string): T | null =>
document.querySelector(selector) as T | null
export const dataset = (el: HTMLElement, key: string): string =>
el.dataset[key] ?? ''