var treeWalker = document.createTreeWalker(document, NodeFilter.SHOW_ALL, null, false); var nodeList = []; while(treeWalker.nextNode()) nodeList.push(treeWalker.currentNode); console.log(nodeList)