Sha256: 802f21bae1d72e27a241c3428a9044184c729d3d8067f0655e9945464a4e8c9e
Contents?: true
Size: 863 Bytes
Versions: 4
Compression:
Stored size: 863 Bytes
Contents
// @ts-check /** * Utility for query selector * * @param {string} query * @param {HTMLElement | null} [container] * @returns {HTMLElement} */ function qs(query, container) { const target = (container) ? container : document; /** @type {HTMLElement | null} */ const result = target.querySelector(query); if (result) { return result; } throw new Error(`No element ${query}`); } /** * Utility for query selector all * * @param {string} query * @param {HTMLElement | null} [container] * @returns {NodeListOf<any>} */ function qsa(query, container) { const target = (container) ? container : document; /** @type {NodeListOf<HTMLElement>} */ const result = target.querySelectorAll(query); return result; } export { qs, qsa };
Version data entries
4 entries across 4 versions & 1 rubygems