Questions tagged [treewalker]

4 questions
1
vote
1 answer

Fast tree Walking in Anytree

I have stumbled upon a problem whilst trying to walk my binary tree constructed using AnyNode from anytree. First, I need to say that each node has a specific id associated with it, so that the root node has an id=0, its children id=1 and id=2. Then…
0
votes
0 answers

getElementsByClassName vs TreeWalker

If getElementsByClassName can replace using TreeWalker, is it a good idea to do so ? What are the benefits of using one over the other if the only objective is to replace a DOM element with a particular classname with another DOM element (or append…
PlanBuildr
  • 167
  • 1
  • 4
  • 14
0
votes
0 answers

Treewalker's NodeFilter.SHOW_TEXT not returning text from non HTML tags

Does document.createTreeWalker parse only valid DOM elements ? let allTextNodes = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT); For example at : https://www.crunchbase.com/organization/olivia-ai-inc - does it not return text…
anjanesh
  • 3,771
  • 7
  • 44
  • 58
-4
votes
4 answers

How to extract a websites HTML tags in DOM and shadowDOM

I'm trying to get the html structure of multiple websites using NodeJS, and I'm having difficulties. I want to get just the HTML structure of the document, and no content. I want to preserve classes, IDs, and other attributes. Example of what I want…
Brad
  • 2,237
  • 5
  • 41
  • 69