Sunday, April 8, 2018

What is a Document Object Model?

The DOM (Document Object Model) is a tree representation of the element hierarchy in a web page. Each element in a HTML page is a node in the DOM tree arranged in a hierarchy. With complex modern UI applications and SPA (single page applications) the DOM is becoming heavier with hundreds of thousands of nodes.

Before a web page is loaded the browser creates the DOM representation of the page. DOM is required to perform dynamic updates to a web page, since the DOM is a tree hierarchy we can traverse the tree to find and update specific elements in the tree. To dynamically modify the contents of the page we an use JavaScript methods like getElementById().

Search Flipkart Products:
Flipkart.com

No comments: