From b2c9b99ab8fc3df6aad737bde5ea49b80cc3f784 Mon Sep 17 00:00:00 2001 From: mkelvers Date: Sun, 10 May 2026 18:34:02 +0200 Subject: [PATCH] feat: add shared q() qs() DOM helpers --- static/q.ts | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 static/q.ts diff --git a/static/q.ts b/static/q.ts new file mode 100644 index 0000000..824fe6f --- /dev/null +++ b/static/q.ts @@ -0,0 +1,8 @@ +export const q = (container: HTMLElement, selector: string): T | null => + container.querySelector(selector) as T | null + +export const qs = (selector: string): T | null => + document.querySelector(selector) as T | null + +export const dataset = (el: HTMLElement, key: string): string => + el.dataset[key] ?? ''