Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 | 1x 3x 4x 4x 3x | /**
* Creates a query function that is scoped to a specific root element.
* This is a safer and more convenient alternative to using `document.querySelector`.
*
* @param root The root element to scope the queries to.
* @returns A typed query function.
*/
export function scopeQuery(root: Element) {
return function query<T extends Element>(selector: string): T | null {
return root.querySelector<T>(selector);
};
}
|