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
36 lines (35 loc) • 1.4 kB
TypeScript
/**
* Find an element by given CSS selector
*
* @param queries - CSS selector to find elements by
* @param first - Return only the first found element
* @return List of found DOM elements
*/
declare function findByQuery(queries: string | string[], first: true): Element | null;
/**
* Find an element by a given CSS selector from within a given element
*
* @param elm - The DOM element to start the search from
* @param queries - CSS selector to find elements by
* @param first - Return only the first found element
* @return List of found DOM elements
*/
declare function findByQuery(elm: Document | Element, queries: string | string[], first: true): Element | null;
/**
* Find all elements matching a given CSS selector
*
* @param queries - CSS selector to find elements by
* @param first - Return only the first found element
* @return List of found DOM elements
*/
declare function findByQuery(queries: string | string[], first?: false): Element[];
/**
* Find all elements matching a given CSS selector from within a given element
*
* @param elm - The DOM element to start the search from
* @param queries - CSS selector to find elements by
* @param first - Return only the first found element
* @return List of found DOM elements
*/
declare function findByQuery(elm: Document | Element, queries: string | string[], first?: false): Element[];
export default findByQuery;