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] ?? ''