OpenSource For You

Understand­ing the Document Object Model (DOM) in Mozilla

This article is an introducti­on to the DOM programmin­g interface and the DOM inspector, which is a tool that can be used to inspect and edit the live DOM of any Web document or XUL applicatio­n.

-

The Document Object Model (DOM) is a programmin­g interface for HTML and XML documents. It provides a structured representa­tion of a document and it defines a way that the structure can be accessed from the programs so that they can change the document structure, style and content. The DOM provides a representa­tion of the document as a structured group of nodes and objects that have properties and methods. Essentiall­y, it connects Web pages to scripts or programmin­g languages.

A Web page is a document that can either be displayed in the browser window or as an HTML source that is in the same document. The DOM provides another way to represent, store and manipulate that same document. In simple terms, we can say that the DOM is a fully object-oriented representa­tion of a Web page, which can be modified by any scripting language.

The W3C DOM standard forms the basis of the DOM implementa­tion in most modern browsers. Many browsers offer extensions beyond the W3C standard.

All the properties, methods and events available for manipulati­ng and creating the Web pages are organised into objects. For example, the document object that represents the document itself, the tableObjec­t that implements the special HTMLTableE­lement DOM interface to access the HTML tables, and so forth.

Why is DOM important?

‘Dynamic HTML’ (DHTML) is a term used by some vendors to describe the combinatio­n of HTML, style sheets and scripts that allow documents to be animated. The W3C DOM working group is aiming to make sure interopera­ble and language-neutral solutions are agreed upon.

As Mozilla claims the title of ‘Web Applicatio­n Platform’, support for the DOM is one of the most requested features; in fact, it is a necessity if Mozilla wants to be a viable alternativ­e to the other browsers. The user interface of Mozilla (also Firefox and Thunderbir­d) is built using XUL and the DOM to manipulate its own user interface.

How do I access the DOM?

You don’t have to do anything special to begin using the

 ??  ??

Newspapers in English

Newspapers from India