The Document Object Model(DOM) is an application programming interface for HTML and XML documents. It defines logical structure of documents and how a document can be accessed and manipulated using it.
The HTML Document, when parsed by the browser, is converted into DOM for all further operations. The DOM represents HTML Document as a tree structure of tags as shown below. For example:
<title>DOM | Hackinbits</title>
<h1>Welcome to hackinbits<h1>
<p> Learn programming and technology in bits.<p>
This Document will be structured internally as :
You can edit the example document and see the tree structure at this link hixie.ch
Let's discuss briefly how HTML document is parsed by the browser and DOM is generated. When the browser processes HTML document, it performs following steps:
The DOM generated by above steps are used by the browser for all further processing.