Skip to content

Instantly share code, notes, and snippets.

View theswedishdev's full-sized avatar
🇺🇦
Slava Ukraini

Joel E. theswedishdev

🇺🇦
Slava Ukraini
View GitHub Profile
@surma
surma / findall_elements_deep.js
Last active October 25, 2020 16:41 — forked from ebidel/findall_elements_deep.js
Finds all elements on the page, including those within shadow dom — iterator version
/**
* Inspired by ebidel@ (https://gist.github.com/ebidel/1b418134837a7dde7d76ed36288c1d16)
* @author surma@
* License Apache-2.0
*/
function* collectAllElementsDeep(selector = '*', root = document.all) {
for (const el of root) {
if (!el.matches(selector))
continue;