views:

42

answers:

3

Hi All!

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?

Thank you!

A: 

You answered your own question :)

Rahul
A: 

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

ZloiAdun
Thanks for your fast response. What I want to do is to detect what tag is load the latest. Practically, I try to implement an event what will be fired when the DOM is completed loaded ( same idea as $(document).ready(function(){}) in jQuery. Since now, I successfully managed to do that but I try to test if it is corect.
Ungureanu Liviu
+3  A: 

More or less. The HTML 5 draft has a parsing algorithm.

David Dorward
Thank you! Really useful!
Ungureanu Liviu