style: format static/q.ts
This commit is contained in:
16
static/q.ts
16
static/q.ts
@@ -1,16 +1,10 @@
|
|||||||
/**
|
/** QuerySelector on a container element, scoped to that element. */
|
||||||
* querySelector on a container element, scoped to that element.
|
|
||||||
*/
|
|
||||||
export const q = <T extends Element>(container: HTMLElement, selector: string): T | null =>
|
export const q = <T extends Element>(container: HTMLElement, selector: string): T | null =>
|
||||||
container.querySelector(selector) as T | null;
|
container.querySelector(selector);
|
||||||
|
|
||||||
/**
|
/** QuerySelector on the document. */
|
||||||
* querySelector on the document.
|
|
||||||
*/
|
|
||||||
export const qs = <T extends Element>(selector: string): T | null =>
|
export const qs = <T extends Element>(selector: string): T | null =>
|
||||||
document.querySelector(selector) as T | null;
|
document.querySelector(selector);
|
||||||
|
|
||||||
/**
|
/** Get a data attribute value from an element, defaults to empty string. */
|
||||||
* Get a data attribute value from an element, defaults to empty string.
|
|
||||||
*/
|
|
||||||
export const dataset = (el: HTMLElement, key: string): string => el.dataset[key] ?? "";
|
export const dataset = (el: HTMLElement, key: string): string => el.dataset[key] ?? "";
|
||||||
|
|||||||
Reference in New Issue
Block a user