Skip to content

Instantly share code, notes, and snippets.

@shitalm
shitalm / queryselector.js
Created August 20, 2020 08:27
querySelectorAll with regex support
/**
* querySelectorAll with regex support.
* TS version: https://gist.github.com/sagirk/3240407ebbc9369356759a806b66fe34.
*
* Note: In the `attributeToSearch` parameter's absence, all attributes on all
* DOM nodes will be searched. This can get quite expensive for large DOM trees.
*
* Usage example:
* `querySelectorAllRegex(/someregex/, 'target-specific-attribute-if-needed');`
*