Skip to content

Instantly share code, notes, and snippets.

@iankit3
Created February 28, 2020 08:55
Show Gist options
  • Save iankit3/74340996bf6e1eef8bde5b02d901a968 to your computer and use it in GitHub Desktop.
Save iankit3/74340996bf6e1eef8bde5b02d901a968 to your computer and use it in GitHub Desktop.
(function(){
var r = document.getRootNode();
var stack = [], list = [];
stack.push(r);
while(stack.length > 0){
var top = stack.pop();
if(top.childNodes.length > 0){
Array.from(top.childNodes)
.filter(e => e.nodeType == Node.ELEMENT_NODE)
.forEach(e => {
stack.push(e);
});
}
if(top.classList && top.classList.contains("hoverable")){
list.push(top);
}
}
console.log(list)
}())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment