4.10. Browsers see the world upside downOf course, browsers don't literally store a picture of a tree with your markup on it. If you want to really understand what the browser stores in memory, you need to learn about the DOM. Let's see how the browser takes the tree you just looked at and represents it with objects. First, the browser flips the entire tree upside down so the <html> element is at the top of the tree instead of the bottom: html When you're working with the DOM, the "top" of the tree is the root element. In a web page, that's <html>. parenthead body title With this "top-down" view of the HTML, you can see a node's parent element, and any child nodes, easily child "Binary Tree Selection" p p a "." "Below are our fine binary tree options:" "Main Menu" div "You can view other products in the " "Our " Even though we flipped the tree over, we still move from left-to-right when we order nodes. em div " trees are a favorite for nearby neighbors." "depth-first" em "breadth-first" "Our " Here's the text in the second <div>, broken up into several text nodes to keep the emphasized word in the right place. " trees are great for folks that are far away." |