Sunday, November 29, 2015

Creation of DOM


What do we mean by DOM?

Document Object Model (DOM) is a cross-platform and language-independent convention for representing and interacting with objects in HTMLXHTML, and XMLdocuments.

Steps






  Sample DOM tree


  • Whenever a browser encounters an html tag the browser it emits a token in the above case it is <html>. This entire process is done by tokenizer
  • There is another process that is consuming this token and converting them to node
  • Eventually once we consume all the tokens we arrive at the DOM tree

    Note
  1. Tokenizer has start and end tokenizer which tells the relation between the nodes  Ex: head tag starts and ends between html
  2. The object contains all the content and the properties
  3. Browser constructs the DOM incrementally. We can take advantage of it

Html content gets converted to DOM tree

      



No comments:

Post a Comment