Simple wrapper of querySelectorAll + addEventListener
dom('.some').find<HTMLInputElement>('.fuga').on('click', e => { ... })Returns dom collection that only provides .on() and .find()
All elements that matched the selector
addEventListener() to all elements that matches the selector
// all .some has now event listeners
dom('.some').on('click', e => { ... }).on() returns a function that removes event listeners
const off = dom('.some').on('click', e => { ... })
// now all event listeners for click is removed
off()querySelectorAll() to all elements and create new dom() instance with the flattend one.
※ This method is using Array.prototype.flatMap under the hood. Make sure your supported browsers have it or you should polyfill it.