Javascript-ONLY DOM Tree Traversal - DFS and BFS?

前端 未结 3 631
小鲜肉
小鲜肉 2021-02-05 14:38

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

3条回答
  •  醉酒成梦
    2021-02-05 15:05

    For DFS you can use the TreeWalker or NodeIterator API and filter with NodeFilter.SHOW_ELEMENT.

提交回复
热议问题