vanillajs-browser-helpers
Version:
Collection of convenience code snippets (helpers) that aims to make it a little easier to work with vanilla JS in the browser
21 lines (20 loc) • 998 B
TypeScript
/**
* Find elements by a given selector. The selector will be lightly analysed to determine
* the appropriate `findByXX` function. This should be faster than just [running querySelector(All)
* to find elements](https://jsperf.com/queryselector-vs-selective-find/1)
*
* @param selector - The selector to use
* @return List of found DOM elements
*/
declare function find(selector: string): HTMLElement | Element | Element[] | null;
/**
* Find elements by a given selector from a given element. The selector will be lightly analysed to determine
* the appropriate `findByXX` function. This should be faster than just [running querySelector(All)
* to find elements](https://jsperf.com/queryselector-vs-selective-find/1)
*
* @param elm - The DOM element to start the search from
* @param selector - The selector to use
* @return List of found DOM elements
*/
declare function find(elm: Document | Element, selector: string): HTMLElement | Element | Element[] | null;
export default find;