Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
export function el<K extends keyof HTMLElementTagNameMap>(
tag: K,
attrs: Record<string, string> = {},
children: (Node | string)[] = [],
): HTMLElementTagNameMap[K] {
const node = document.createElement(tag);
for (const [key, value] of Object.entries(attrs)) node.setAttribute(key, value);
node.append(...children);
return node;
}
export function qs<T extends Element>(root: ParentNode, selector: string): T {
const node = root.querySelector<T>(selector);
if (!node) throw new Error(`missing element ${selector}`);
return node;
}
4121c9fb7This file is pinned to the selected release. Download the original to open it in your design tool.