Thursday, 7 May 2015

Filled Under: , ,

What is DOM (document object model)? An overview...


            DOM tells us that how our page accesses our script and how our script accesses our script, simple is that.
To have a better understanding of it, we simply divide it into D, O and M:
D (Document): For a web developer document should simply mean a page (a web-page). It can be form of source code or browser view.
O (Object): All those entities or things which can be treated as an individual piece. For a programmer an object can be a single code, a line of code or beyond it. On the other hand for a user it can be a heading, a paragraph or anything like this. Sometimes an object may contain another object like <ol> (ordered list (used for listing items in HTML)) contains many <li> (list items (used for sub listing in HTML)).
M (Model): A set of agreed-upon terms to represent a document. Like classifying <head> (JavaScript keyword for header) as a parent for <ol> (JavaScript keyword for ordered list).
                        So, we can now easily say that DOM is neither a language nor a library but it is just convention or way to organize your code in a better way.
                        DOM uses different nodes to represent a document. So, explaining node first…
Node: In DOM every single entity (tag, text, etc.) is represented by a node. Following is the list of all 12 DOM attributes…
1.      ELEMENT Node
2.      ATTRIBUTE Node
3.      TEXT Node
4.      CDATA SECTION Node
5.      ENTITY REFERENCE Node
6.      ENTITY Node
7.      PROCESSING INSTRUCTION Nodes
8.      COMMENT Node
9.      DOCUMENT Node
10.  DOCUMENT TYPE Node
11.  DOCUMENT FRAGMENT Node
12.  NOTATION Node
But we actually are interested in three of them ELEMENT Node, ATTRIBUTE Node, TEXT Node.

0 comments:

Post a Comment