The DOM standard is concerned with mapping document components to an object model which reflects the values defined in HTML tag attributes. These are visible to the script writer as object properties. In case of conflicts with reserved words and object names in the JavaScript context, any conflicting names will have the"html" prefix. An example is the "for" attribute which becomes the "htmlFor" property. The HTML tag that instantiated an object is reflected in the tagName property of each element object. All document elements derived from HTML tags are sub-classed from the Element class.
The W3C Document Object Model standard is being reviewed and updated to enhance the support of the document in the browser. There are several levels to this standard:
Level 0 - The more or less de-facto situation with the version 4 browsers.
Level 1 - Text, elements and attributes of HTML and XML.
Level 2 - Views, traversals, events and stylesheets standardized.
Level 3 - More work on events and the content model introduced.
Future - Potential standardization of the security model and standardization of the context and environment in which the document exists.
Thankfully now that browsers are converging on the same standards the amount of duplicated effort will diminish over time as the older browsers are replaced. Netscape 6.0 is just beginning to ship. Beta versions of MSIE version 6.0 are imminent and Opera version 5 is likely to be similarly capable as regards DOM compliance. DOM level 1 seems to be roughly where we are at present.
Browser manufacturers make grand claims to be ECMAScript compliant as well as DOM compliant. This claim is somewhat suspect. Providing objects with the functionality of DOM specified classes but having different class names does not completely satisfy the requirements for DOM compliance. We may ultimately end up with objects being mirrored into duplicate instances under different class names to satisfy DOM class naming and to preserve legacy support.
MSIE at version 5 supports a DOM like object model with Microsoft specific class names. Netscape 6 supports a highly DOM compliant object model with correct object class names. When testing the PR3 beta version of Netscape 6.0, it looked like several HTML tags instantiated objects of the same class when they should have been different but this may have gone away in the final release.
As browser manufacturers support more standardized interfaces, we may be better off in some areas but are also likely to be inconsistent between the browsers in some new areas.
As the new levels are introduced and add new modules, they often extend the interfaces of existing classes. The DOM standard accomplishes this by defining new classes as if they were a sub-class of the object they extend. This provides some opportunity for implementors to name object classes incorrectly in early version of their DOM support. For example, event handling extends the Document object to allow it to create new events. This would really be an extension of the Document object and would likely not be implemented by sub-classing Document to create a DocumentEvent object. Were that the way the implentor had chosen, we would have a DOM hierarchy model that had been structurally altered by the insertion of a new sub-class between Document and HTMLDocument and we already have enough confusion between those two object classes across browsers.
The support for DOM in Netscape 4 is so vestigial that it cannot really be called a DOM implementation at all. This is corrected in Netscape 6.0 which supports DOM level 1 and additionally supports some DOM level 2 features to do with Event handling.
Prev | Home | Next |
DocumentType object | Up | DOM - Level 0 |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |