Created
April 2, 2019 01:49
-
-
Save snewcomer/517d90a1c322899e318d525977973490 to your computer and use it in GitHub Desktop.
Tree Walker
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 indexTree(root) { | |
var treeWalker = document.createTreeWalker( | |
root, | |
NodeFilter.SHOW_ELEMENT); | |
var el; | |
while((el = treeWalker.nextNode())) { | |
var key = getNodeKey(el); | |
if (key) { | |
fromNodesLookup[key] = el; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment