4 ms·
When you’re using a programming language and you want a nice data structure to understand the html page and it’s rendered version, you use a tree and that tree
by skydhash 4y ago
When you’re using a programming language and you want a nice data structure to understand the html page and it’s rendered version, you use a tree and that tree is what is called the DOM. It could have been a list, but manipulation would have been cumbersome. So the DOM is a tree, where each node is an object with direct connection to how it’s rendered on the screen.
(Most programming languages, including HTML, are transformed into a tree when you want to understand the semantics, or what each construct implies)