47528

How DOM works/is loaded? (in HTML)

Question:

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!

Answer1:

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

Recommend

  • Powershell Transcript is empty when running script from SQL Agent Job in 2005 SQL Server
  • Sorting elements of vector where each element is a pair [duplicate]
  • How to restrict number of concurrent processes?
  • Selenium and Google - How do you use cookies?
  • Use neo4j server instead of embedded mode
  • Dependable views in Ember
  • MySQL multiple IN conditions to subquery with same table
  • How to create virtual printer with iOS Simulator?
  • removing last 3 characters on a file (file extension)
  • Avoid registering duplicate broadcast receivers in Android
  • Java making confirming exit
  • Is it possible to get the word under the mouse cursor in a ``?
  • BeautifulSoup difference between findAll and findChildren
  • NHibernate manually control fetching
  • Debugging VB6 Code From Visual Studio 2010
  • How to remove a SwiftyJSON element?
  • Not able to aggregate on nested fields in elasticsearch
  • How to define and use opencv mat of user type
  • Ajax Loaded meta Tags
  • Disabling Alt-F4 on a Win Forms NotifyIcon
  • Incrementing object id automatically JS constructor (static method and variable)
  • Cassandra Data Model
  • Can a Chrome extension content script make an jQuery AJAX request for an html file that is itself a
  • Symfony2: How to get request parameter
  • Weird JavaScript statement, what does it mean?
  • jquery mobile loadPage not working
  • Comma separated Values
  • How to get icons for entities from eclipse?
  • File upload with ng-file-upload throwing error
  • Proper way to use connect-multiparty with express.js?
  • Load html files in TinyMce
  • Error creating VM instance in Google Compute Engine
  • Free memory of cv::Mat loaded using FileStorage API
  • Hits per day in Google Big Query
  • how does django model after text[] in postgresql [duplicate]
  • Getting Messege Twice Using IMvxMessenger
  • Java static initializers and reflection
  • unknown Exception android
  • JaxB to read class hierarchy
  • Python/Django TangoWithDjango Models and Databases