How DOM is loaded in a html page? First is load the all html tag ( ) and inside of this element is created an other element and so on or first is create followed by ... and finally, the closing tags are added?
More or less. The HTML 5.2 specification has a <a href="https://www.w3.org/TR/2017/REC-html52-20171214/syntax.html#parsing-html-documents" rel="nofollow">parsing algorithm</a>.Answer2:
Generally the whole DOM is loaded into the memory, the order in which the elements are created is internal to the parser implementation and is not exposed.
If you need to parse as document loads you have to use SAX parsers