I would like to know about the "dom tree" and "render tree" difference ?
Is the render tree constructed from the "dom tree" or It is different tree made by browser ?
I would like to know about the "dom tree" and "render tree" difference ?
Is the render tree constructed from the "dom tree" or It is different tree made by browser ?
Great question. The DOM tree is essentially the tree containing all of your HTML elements (nodes), whereas the render tree is a culmination of the DOM and CSSOM trees. The render tree is the one that is actually rendered onto the page. Hope this helps! I have written an article about this, check it out :)
archived Web Science - Browser Internals (Rendering - Constructing the DOM Tree)
http://www.jjburton.com/2016/02/12/web-science-browser-internals-rendering.html (Dead Link)
The big question...'How does the browser render a web page?'. Before starting, let's quickly answer some sub-questions: …
These are some very good articles, I think you should read first!
What Every Frontend Developer Should Know About Webpage Rendering
How browsers work : Behind the scenes of modern web browsers
Render-tree Construction, Layout, and Paint
hope for help for you!
Render tree is created by combining the DOM tree (Made from parsing the HTML) and CSSOM(Made from parsing the CSS defined for the document) tree.
Render tree only contains the nodes which will be visible on the screen, i.e. if the display for any of the node is marked as none
then it won't be the part of the render tree.
Render tree is then passed to the layout phase and eventually to the paint phase which paints the actual pixels on the screen and the content is visible to you.
To answer your question: Both dom tree and render tree is created by the browser only and yes render tree is made from the dom tree as explained above.