Friday, 27 July 2012

DOM, Page layouts

The HTML-DOM tree

HTML DOM:
         The HTML DOM interprets the HTML document as a tree structure. The DOM is like an API which interprets a HTML document in the following format. The DOM has a tree structure which has the document as the parent. 
             
                     The DOM helps in retrieving individual elements in the script language using the structure provided above. In the above mentioned tree the attribute, text, elements and comments are placed in the nodes of the tree. HTML DOM allows scripting languages to get the nodes and to process or apply changes over them.

For example (javascript) : we can use Document.getElementbyID('name'); will get an element from the HTML document which contains the give ID.
                 There also exists relationship between the nodes.
                 The above picture gives a clear picture of the relationships between different nodes in the tree. Each node is associated with some properties and methods. Properties are the values of nodes which can be extracted to use or changed. Methods are the methods which can be done over the nodes.

Document.getElementbyID('something').innerHTML; here getting the element is a method and the innerHTML is a property which is being retrieved.

Browser Specific Elements:
         
       Browser is a rendering machine. It gets the HTML page is interpreted it and displays the contents in the programmer desired format.  The rendering of the web page has the following process.






        The Render tree is built by combining the HTML file along with the CSS file which is included by the HTML page. Each browser has its own method of creating the web page by interpreting the DOM. Not all browsers will interpret the web page in the same manner. The difference may arise in the compatibility of the web browser.
       Most of the HTML4 commands will execute properly in all the standard web browsers. But the recently developed HTML5 is not widely supported and the same page will not be rendered properly in all browsers. Hence it is better to go for HTML4 for the time being till HTML5 is well established so that it could be used in all the web browsers.

No comments:

Post a Comment