Charls

Submitted by: Submitted by

Views: 10

Words: 361

Pages: 2

Category: Music and Cinema

Date Submitted: 09/02/2015 07:18 AM

Report This Essay

Types and Objects of DOM

Types of DOM:

* Document - When a member returns an object of type document (e.g., the owner Document property of an element returns the document to which it belongs), this object is the root document object itself. The DOM document Reference chapter describes the document object.

* Element - element refers to an element or a node of type element returned by a member of the DOM API. Rather than saying, for example, that the document.createElement()method returns an object reference to a node, we just say that this method returns the element that has just been created in the DOM. element objects implement the DOM Element interface and also the more basic Node interface, both of which are included together in this reference.

* nodeList - A nodeList is an array of elements, like the kind that is returned by the methoddocument.getElementsByTagName(). Items in a nodeList are accessed by index in either of two ways.

* Attribute - When an attribute is returned by a member (e.g., by the createAttribute()method), it is an object reference that exposes a special (albeit small) interface for attributes. Attributes are nodes in the DOM just like elements are, though you may rarely use them as such.

* nameNodeMap - A namedNodeMap is like an array, but the items are accessed by name or index, though this latter case is merely a convenience for enumeration, as they are in no particular order in the list. A namedNodeMap has an item() method for this purpose, and you can also add and remove items from a namedNodeMap.

Objects of DOM:

Many objects borrow from several different interfaces. The table object, for example, implements a specialized HTML Table Element Interface, which includes such methods as createCaption and insertRow. But since it's also an HTML element, table implements the Element interface described in the DOM element Reference chapter. And finally, since an HTML element is also, as far as the DOM is...