179Chapter 14Document Object Model EssentialsMore importantly, when you (Web file server)

179Chapter 14Document Object Model EssentialsMore importantly, when you consider the changes to referencing other elements in the W3CDOM (discussed in the next section), we re lucky that the old ways of referencing objectssuch as forms, form control elements, and images still work. Had the working group beenplanning from a clean slate, it is unlikely that the documentobject would have been givenproperties consisting of arrays of forms, links, and images. The only potential problems you could encounter with your existing code have to do with ahandful of properties that used to belong to the documentobject. In the new DOM, fourstyle-related properties of the documentobject (alinkColor, bgColor, linkColor, andvlinkColor) become properties of the bodyobject (referenced as document.body). In addi- tion, the three link color properties pick up new names in the process (aLink, link, vLink). It appears, however, that for now, IE6 and Moz1 maintain backward compatibility with theolder document object color properties. Also, note that the DOM specification concerns itself only with the document and its content. Objects such as window, navigator, and screenare not part of the DOM specification throughLevel 2. Scripters are still at the mercy of browser makers for compatibility in these areas, butthe windowobject (or its equivalent) likely will be added to the W3C DOM Level 3. What isn t availableAs mentioned earlier, the W3C DOM is not simply a restatement of existing browser specifica- tions. Many convenience features of the IE and NN object models do not appear in the W3CDOM. If you develop Dynamic HTML content in IE4+ or NN4, you have to learn how to getalong without some of these conveniences. Navigator 4 s experiment with the tag was not successful in the W3C process. As aresult, both the tag and the scripting conventions surrounding it do not exist in the W3C DOM. To some scripters relief, the document.layerNamereferencing scenario (even more complexwith nested layers) disappears from the object model entirely. A positioned element is treatedas just another element that has some special stylesheet attributes that enable you to move itanywhere on the page, stack it amid other positioned elements, and hide it from view. Among popular IE4+ features missing from the W3C DOM are the document.allcollection ofHTML elements and four element properties that facilitate dynamic content: innerHTML, innerText, outerHTML, and outerText. A new W3C way provides for acquiring an array ofall elements in a document, but generating HTML content to replace existing content or beinserted in a document requires a tedious sequence of statements (see the section NewDOM concepts later in this chapter). Mozilla, however, has implemented the innerHTMLproperty for HTML element objects in Mozilla-based browsers (Moz1+). New HTML practicesExploitation of Dynamic HTML possibilities in both IE4+ and the W3C DOM relies on someHTML practices that may be new to long-time HTML authors. At the core of these practices(espoused by the HTML 4.0 specification) is making sure that all content is within an HTMLcontainer of some kind. Therefore, instead of using the

tag as a separator between blocksof running text, surround each paragraph of the running text with a

tag set. Ifyou don t do it, the browser treats each

tag as the beginning of a paragraph and ends theparagraph element just before the next

tag or other block-level element. While recent browsers continue to accept the omission of certain end tags (for td, tr, and lielements, for instance), it is best to get in the habit of supplying these end tags. If for no otherreason, they help you visualize where an element s sphere of influence truly begins and ends.