Created
September 16, 2013 18:45
-
-
Save ajace/6584732 to your computer and use it in GitHub Desktop.
Crockford's WalkTheDom ex: var root = document.getElementById('div'); walkTheDOM(root, function(node) { console.log( node.nodeName );
});
This file contains hidden or 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 walkTheDOM(node, func) { | |
func(node); | |
node = node.firstChild; | |
while (node) { | |
walkTheDOM(node, func); | |
node = node.nextSibling; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment