Javascript-ONLY DOM Tree Traversal - DFS and BFS?
问题 Can anyone provide either code, pseudocode, or even provide good links to implementing DFS and BFS in plain JavaScript (No JQuery, or any helper libraries)? I've been trying to understand how to implement either traversal, but I can't seem to really distinguish the difference of a BFS and DFS implementation. If we want a concrete problem as an example: I want to traverse down the DOM at a given node, and get all the class names. (The only way I can think to traverse is to go through each