Skip to content

Instantly share code, notes, and snippets.

@trickpattyFH20
Last active May 30, 2018 16:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trickpattyFH20/acdadeeda4ad7a62b1441c9627329967 to your computer and use it in GitHub Desktop.
Save trickpattyFH20/acdadeeda4ad7a62b1441c9627329967 to your computer and use it in GitHub Desktop.
search dom for shadow roots
(() => {
function walkDom(node, func) {
var children = node.childNodes;
for (var i = 0; i < children.length; i++) {
walkDom(children[i], func);
}
func(node);
}
walkDom(document.body, (node) => {
if (node.shadowRoot) {
console.log(node, node.shadowRoot);
}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment