About This Reference
This section describes the guide itself: whom it's for, how the information is presented, and how you can use the examples in the reference in your own DOM development.
Note that this document is under development, and is not currently a comprehensive listing of the DOM methods and properties implemented for Gecko but each individual section of the document (e.g., the DOM Document Reference) is complete for the object(s) it describes. As reference information for the various members of the huge APIs becomes available, it is integrated into this document here.
Who Should Read This Guide
Here introductory material is presented, with many examples, and high-level explanations should be valuable for inexperienced and experienced web developers alike, and it is a not only "beginners" web development guide. In general, however, it is an evolving API reference manual.
What is Gecko?
Mozilla, Firefox, Netscape 6+, and other Mozilla-based browsers have identical implementations of the DOM. This is so because they use the same technology. naturally, it applies only to products based on the same version of Gecko, but it's tricky to explain
Gecko, the software component in these browsers that handles the parsing of the HTML, the layout of the pages, the document object model, and even the rendering of the entire application interface, is a fast, standards-compliant rendering engine that implements the W3C DOM standards and the DOM-like (but not standardized) browser object model (i.e.,
window et al) in the context of web pages and the application interface, or chrome, of the browser.
Though the application interface and the content displayed by the browser are different in many practical ways, the DOM exposes them uniformly as a hierarchy of nodes. (commenting this incomplete sentence out for now...) The tree structure of the DOM (which in its application to the user
Each description in the API reference includes the syntax, the input and output parameters (where the return type is given), an example, any additional notes, and a link to the appropriate specification.
Read-only properties may only be accessed. Since setting them is not possible, they typically have a single line of syntax. For example, the read-only property
availHeight of the
screen object includes the following syntax information:
iAvail = window.screen.availHeight
This means that you can only use the property on the right hand side of the statement.
Read/write properties, however, can have properties accessed or set:
msg = window.status window.status = msg
In general, the object whose member is being described is given in the syntax statement with a simple type, e.g,
element for all elements,
document for the top-level document object, table for the
TABLE object, etc. (see Important Data Types for more information about data types).
Using the Examples
Many of the examples in this reference are complete files which you can execute by cutting and pasting them into a new file, which you can then open in your web browser.
For instance, this window.document property example can be tested within a function. Here, it is called by a button's
Similar functions and pages can be devised for all the object members that are not already packaged up for use. See the Testing the DOM API section in the introduction for a "test harness" that you can use to test a number of APIs all at once.