Created
May 10, 2019 06:05
-
-
Save uni745e/c30b97bf68fe4c7bc718f1ce50fae18e to your computer and use it in GitHub Desktop.
renderDOMTree
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function renderDOMTree(node, level = 0) { | |
if (node.tagName) { | |
console.log(`${'\t'.repeat(level)}${node.tagName}`); | |
} | |
node.childNodes.forEach(childNode => { | |
renderDOMTree(childNode, level + 1); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment