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 HTML, XHTML, 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
- Tokenizer has start and end tokenizer which tells the relation between the nodes Ex: head tag starts and ends between html
- The object contains all the content and the properties
- Browser constructs the DOM incrementally. We can take advantage of it
Html content gets converted to DOM tree
No comments:
Post a Comment