The Document Object Model (DOM) is an application programming interface (API) for HTML as well as XML. The DOM maps out an entire page as a document composed of a hierarchy of nodes. Each part of an HTML or XML page is a derivative of a node. Consider the following HTML page:
<html>
&n
bsp;<head>&n
<title></title>
</head>
<body>
<p>Hello tooshar!</p>
</body>
</html>
This code can be diagrammed into a hierarchy of nodes using the DOM
Dom Levels
DOM Level 1 became a W3C recommendation in October of 1998. It consisted of two modules: the DOM
Core, which provided a way to map the structure of an XML-based document to allow for easy access to
and manipulation of any part of a document, and the DOM HTML, which extended the DOM Core by
adding HTML-specific objects and methods.
Note that the DOM is not JavaScript-specific, and indeed has been implemented in numerous other languages.
For Web browsers, however, the DOM has been implemented using ECMAScript and now
makes up a large part of the JavaScript language.
Whereas DOM Level 1’s only goal was to map out the structure of a document, DOM Level 2’s aims
were much broader. This extension to the original DOM added support for mouse and user interface
events (long supported by DHTML), ranges, traversals (methods to iterate over a DOM document), and
support for Cascading Style Sheets (CSS) through object interfaces. The original DOM Core introduced
in Level 1 was also extended to include support for XML namespaces.
DOM Level 2 introduced several new modules of the DOM to deal with new types of interfaces:
❑ DOM Views — describes interfaces to keep track of the various views of a document (that is, the document before CSS styling and the document after CSS styling)
❑ DOM Events — describes interfaces for events
❑ DOM Style — describes interfaces to deal with CSS-based styles
❑ DOM Traversal and Range — describes interfaces to traverse and manipulate a document tree
DOM Level 3 further extends the DOM with the introduction of methods to load and save documents in
a uniform way (contained in a new module called DOM Load and Save) as well as methods to validate a
document (DOM Validation). In Level 3, the DOM Core is extended to support all of XML 1.0, including
XML Infoset, XPath, and XML Base.

No comments:
Post a Comment