UNPKG

basic-devtools

Version:

Exports `$`, `$$`, and `$x` utilities as described in Chrome Console Utilities API reference

22 lines (21 loc) 1.09 kB
/** * Given a CSS selector, returns the first matching node, if any. * @param {string} css the CSS selector to query * @param {Document | DocumentFragment | Element} [root] the optional parent node to query * @returns {Element?} the found element, if any */ export function $(css: string, root?: Document | DocumentFragment | Element): Element | null; /** * Given a CSS selector, returns a list of all matching nodes. * @param {string} css the CSS selector to query * @param {Document | DocumentFragment | Element} [root] the optional parent node to query * @returns {Element[]} a list of found nodes */ export function $$(css: string, root?: Document | DocumentFragment | Element): Element[]; /** * Given a XPath selector, returns a list of all matching nodes. * @param {string} path the XPath selector to evaluate * @param {Document | DocumentFragment | Element} [root] the optional parent node to query * @returns {Node[]} a list of found nodes (elements, attributes, text, comments) */ export function $x(path: string, root?: Document | DocumentFragment | Element): Node[];