DOCUMENT OBJECT MODEL

From Wikepedia

The Document Object Model (DOM) is a cross-platform and language-independent convention for representing and interacting with objects in HTMLXHTML and XMLdocuments.[1] Objects in the DOM tree may be addressed and manipulated by using methods on the objects. The public interface of a DOM is specified in its application programming interface (API).

 

Standardization

The World Wide Web Consortium (W3C), founded in 1994 to promote open standards for the World Wide Web, brought Netscape Communications and Microsoft together with other companies to develop a standard for browser scripting languages, called “ECMAScript“. The first version of the standard was published in 1997. Subsequent releases of JavaScript and JScript would implement the ECMAScript standard for greater cross-browser compatibility.

After the release of ECMAScript, W3C began work on a standardized DOM. The initial DOM standard, known as “DOM Level 1,” was recommended by W3C in late 1998. About the same time, Internet Explorer 5.0 shipped with limited support for DOM Level 1. DOM Level 1 provided a complete model for an entire HTML or XML document, including means to change any portion of the document. Non-conformant browsers such as Internet Explorer 4.x and Netscape 4.x were still widely used as late as 2000.

DOM Level 2 was published in late 2000. It introduced the “getElementById” function as well as an event model and support for XML namespaces and CSS. DOM Level 3, the current release of the DOM specification, published in April 2004, added support for XPathand keyboard event handling, as well as an interface for serializing documents as XML.

By 2005, large parts of W3C DOM were well-supported by common ECMAScript-enabled browsers, including Microsoft Internet Explorer version 6 (2001)OperaSafari and Gecko-based browsers (like MozillaFirefoxSeaMonkey and Camino).

 

Web browsers

This section may require copy editing for grammar, style, cohesion, tone, or spelling. You can assist by editing it(September 2011)

Web browsers usually use an internal model similar to the DOM in order to render a document (such as an HTML page). The DOM APIs are also used to inspect or modify a Web page from JavaScript code. In other words, the Document Object Model is the way JavaScript sees the browser state and the HTML page it contains.

When an HTML page is rendered in a browser, the browser parses the markup (e.g. HTML), downloaded from the web-server into an in-memory DOM. The DOM is used to construct additional internal structures used to display the page in the browser window.

The nodes of every document are organized in a tree structure, called the DOM tree. The topmost node in the DOM tree is theDocument object. Each node has zero or more children.

An example of a DOM tree is shown below:

 |-> Document
   |-> Element (<html>)
     |-> Element (<body>)
       |-> Element (<div>)
         |-> text node
         |-> Anchor
           |-> text node
       |-> Form
            |-> Text-box
            |-> Text Area
            |-> Radio Button
            |-> Check Box
            |-> Select
            |-> Button

[edit]Implementations

Because DOM supports navigation in any direction (e.g., parent and previous sibling) and allows for arbitrary modifications, an implementation must at least buffer the document that has been read so far (or some parsed form of it).[citation needed]

[edit]Layout engines

Web browsers rely on layout engines to parse HTML into a DOM. Some layout engines such as Trident/MSHTML and Presto are associated primarily or exclusively with a particular browser such as Internet Explorer and Opera respectively. Others, such as WebKitand Gecko, are shared by a number of browsers, such as Google ChromeFirefox and Safari. The different layout engines implement the DOM standards to varying degrees of compliance.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s