185Chapter 14Document (Apache web server tutorial) Object Model EssentialsTable 14-6: Node Object
185Chapter 14Document Object Model EssentialsTable 14-6: Node Object Methods (W3C DOM Level 2) MethodDescriptionIE5+Moz1Safari1appendChild(newChild)Adds child node to end of current nodeYesYesYescloneNode(deep)Grabs a copy of the current node (optionally YesYesYeswith children) ContinuedThe Object-Oriented W3C DOMIf you are familiar with concepts of object-oriented (OO) programming, you will appreciate theOO tendencies in the way the W3C defines the DOM. The Nodeobject includes sets of properties(see Table 14-4) and methods (see Table 14-6) that are inherited by every object based on theNode. Most of the objects that inherit the Node s behavior have their own properties and/ormethods that define their specific behaviors. The following figure shows (in W3C DOM terminol- ogy) the inheritance tree from the Noderoot object. Most items are defined in the Core DOM, while items shown in boldface are from the HTML DOM portion. W3C DOM Node object inheritance tree. You can see from the preceding figure that individual HTML elements inherit properties andmethods from the generic HTML element, which inherits from the Core Elementobject, which, in turn, inherits from the basic Node. It isn t important to know the Nodeobject inheritance to script the DOM. But it does help explainthe ECMA Script Language Binding appendix of the W3C DOM recommendation, as well as explainhow a simple element object winds up with so many properties and methods associated with it. Node+–Document| +–HTMLDocument+–CharacterData| +–Text| | +–CDATASection| +–Comment+–Attr+–Element| +–HTMLElement| +– (Each specific HTML element) +–DocumentType+–DocumentFragment+–Notation+–Entity+–Entity Reference+–ProcessingInstruction