178Part IIIDocument Objects ReferenceTo make (Java web server) this work effectively,

178Part IIIDocument Objects ReferenceTo make this work effectively, the working group divided the DOM specification into two sec- tions. The first, called the Core DOM, defines specifications for the basic document structurethat both HTML and XML documents share. This includes notions of a document containingelements that have tag names and attributes; an element is capable of containing zero ormore other elements. The second part of the DOM specification addresses the elements andother characteristics that apply only to HTML. The HTML portion inherits all the features ofthe Core DOM, while providing a measure of backward compatibility to object models alreadyimplemented in legacy browsers and providing a framework for new features. It is important for veteran scripters to recognize that the W3C DOM does not specify all fea- tures from existing browser object models. Many features of the IE4 (and later) object modelare not part of the W3C DOM specification. This means that if you are comfortable in the IEenvironment and wish to shift your focus to writing for the W3C DOM spec, you have to changesome practices as highlighted in this chapter. Navigator 4 page authors lose the tag(which is not part of HTML 4.0 and likely will never see the light of day in a standard) as well asthe layer object. In many respects, especially with regard to Dynamic HTML applications, theW3C DOM is an entirely new DOM with new concepts that you must grasp before you can suc- cessfully script in the environment. By the same token, you should be aware that whereas Mozilla-based browsers go to greatlengths to implement all of DOM Level 1 and most of Level 2, Microsoft (for whatever reason) features only a partial implementation of the W3C DOM through IE5.5. Although IE6 imple- ments more W3C DOM features, some important parts, notably W3C DOM events, are miss- ing. Other modern browsers, such as Safari, provide basic W3C DOM support, but have notyet caught up with Mozilla levels of DOM support. DOM levelsLike most W3C specifications, one version is rarely enough. The job of the DOM workinggroup was too large to be swallowed whole in one sitting. Therefore, the DOM is a continuallyevolving specification. The timeline of specification releases rarely coincides with browserreleases. Therefore, it is very common for any given browser release to include only some ofthe most recent W3C version. The first formal specification, DOM Level 1, was released well after NN4 and IE4 shipped. The HTML portion of Level 1 includes DOM Level 0. This is essentially the object model asimplemented in Navigator 3 (and for the most part in Internet Explorer 3 plus image objects). Perhaps the most significant omission from Level 1 is an event model (it ignores even thesimple event model implemented in NN2 and IE3). DOM Level 2 builds on the work of Level 1. In addition to several enhancements of both theCore and HTML portions of Level 1, Level 2 adds significant new sections (published as sepa- rate modules) on the event model, ways of inspecting a document s hierarchy, XML names- paces, text ranges, stylesheets, and style properties. Work on Level 3 is under way, but verylittle of it has yet reached browsers. What stays the sameBy adopting DOM Level 0 as the starting point of the HTML portion of the DOM, the W3C pro- vided a way for a lot of existing script code to work even in a W3C DOM-compatible browser. Every object you see in the original object model starting with the documentobject (seeFigure 14-1) plus the image object are in DOM Level 0. Almost all of the same object proper- ties and methods are also available.