Skip to content

Instantly share code, notes, and snippets.

@Artur-
Created August 7, 2020 06:23
Show Gist options
  • Save Artur-/a08faa7e0fc400394c6c2113ccb07e18 to your computer and use it in GitHub Desktop.
Save Artur-/a08faa7e0fc400394c6c2113ccb07e18 to your computer and use it in GitHub Desktop.
const findAll = (element,tag) => {
const lightDom = Array.from(element.querySelectorAll(tag));
const shadowDom = Array.from(element.querySelectorAll("*")).filter(e => e.shadowRoot).flatMap(e => findAll(e.shadowRoot, tag));
return [...lightDom, ...shadowDom];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment