| Availability: |
| ||||||
| JavaScript syntax: | - | myNode = myMutationEvent.relatedNode | |||||
| Object properties: | firstChild, lastChild, nextSibling, nodeName, nodeType, nodeValue, ownerDocument, parentNode, previousSibling | ||||||
| Class constants: | ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE | ||||||
| Object methods: | appendChild(), cloneNode(), hasChildNodes(), insertBefore(), removeChild(), replaceChild() | ||||||
| Collections: | attributes[], childNodes[] | ||||||
Here is a list of the available node types:
| Constant | Type | Description |
|---|---|---|
| undefined | null | A member of the attributes collection |
| ELEMENT_NODE | 1 | HTML element object node |
| ATTRIBUTE_NODE | 2 | HTML tag attribute object |
| TEXT_NODE | 3 | Text object node |
| CDATA_SECTION_NODE | 4 | CDATA section |
| ENTITY_REFERENCE_NODE | 5 | Entity reference |
| ENTITY_NODE | 6 | Entity node |
| PROCESSING_INSTRUCTION_NODE | 7 | Processing instruction node |
| COMMENT_NODE | 8 | Comment node |
| DOCUMENT_NODE | 9 | Document object |
| DOCUMENT_TYPE_NODE | 10 | Doctype object |
| DOCUMENT_FRAGMENT_NODE | 11 | Document fragment node |
| NOTATION_NODE | 12 | Notation node |
The DOM level 2 specification adds the following methods:
supports()
normalize()
It also adds the following properties:
namespaceURI
prefix
localName
At DOM level 3, the interface to the Node object is expected to evolve further to allow nodes to be compared and to be able to extract a serialized version of a DOM tree branch into a string primitive. This functionality is still under review as this is being written. The following additional properties are expected to be supported:
baseURI
textContent
key
DOM level 3 is expected to add the following methods to the Node object:
compareDocumentOrder()
compareTreePosition()
isSameNode()
lookupNamespacePrefix()
lookupNamespaceURI
normalizeNS()
setUserData()
getUserData()
If the implementation supports the DOM level 2 event model (this is the case with Netscape 6.0), then the Node object should also support the methods and properties defined by the EventTarget object.
| Property | JavaScript | JScript | N | IE | Opera | NES | ECMA | DOM | CSS | HTML | Notes |
|---|---|---|---|---|---|---|---|---|---|---|---|
| firstChild | 1.5 ![]() | 5.0 ![]() | 6.0 ![]() | 5.0 ![]() | ![]() | ![]() | ![]() | 1 ![]() | ![]() | ![]() | - |
| lastChild | 1.5 ![]() | 5.0 ![]() | 6.0 ![]() | 5.0 ![]() | ![]() | ![]() | ![]() | 1 ![]() | ![]() | ![]() | - |
| nextSibling | 1.5 ![]() | 5.0 ![]() | 6.0 ![]() | 5.0 ![]() | ![]() | ![]() | ![]() | 1 ![]() | ![]() | ![]() | - |
| nodeName | 1.5 ![]() | 5.0 ![]() | 6.0 ![]() | 5.0 ![]() | ![]() | ![]() | ![]() | 1 ![]() | ![]() | ![]() | - |
| nodeType | 1.5 ![]() | 5.0 ![]() | 6.0 ![]() | 5.0 ![]() | ![]() | ![]() | ![]() | 1 ![]() | ![]() | ![]() | - |
| nodeValue | 1.5 ![]() | 5.0 ![]() | 6.0 ![]() | 5.0 ![]() | ![]() | ![]() | ![]() | 1 ![]() | ![]() | ![]() | - |
| ownerDocument | 1.5 ![]() | 5.0 ![]() | 6.0 ![]() | 5.0 ![]() | ![]() | ![]() | ![]() | 1 ![]() | ![]() | ![]() | - |
| parentNode | 1.5 ![]() | 5.0 ![]() | 6.0 ![]() | 5.0 ![]() | ![]() | ![]() | ![]() | 1 ![]() | ![]() | ![]() | - |
| previousSibling | 1.5 ![]() | 5.0 ![]() | 6.0 ![]() | 5.0 ![]() | ![]() | ![]() | ![]() | 1 ![]() | ![]() | ![]() | - |
| Method | JavaScript | JScript | N | IE | Opera | NES | ECMA | DOM | CSS | HTML | Notes |
|---|---|---|---|---|---|---|---|---|---|---|---|
| appendChild() | 1.5 ![]() | 5.0 ![]() | 6.0 ![]() | 5.0 ![]() | ![]() | ![]() | ![]() | 1 ![]() | ![]() | ![]() | - |
| cloneNode() | 1.5 ![]() | 5.0 ![]() | 6.0 ![]() | 5.0 ![]() | ![]() | ![]() | ![]() | 1 ![]() | ![]() | ![]() | - |
| hasChildNodes() | 1.5 ![]() | 5.0 ![]() | 6.0 ![]() | 5.0 ![]() | ![]() | ![]() | ![]() | 1 ![]() | ![]() | ![]() | - |
| insertBefore() | 1.5 ![]() | 5.0 ![]() | 6.0 ![]() | 5.0 ![]() | ![]() | ![]() | ![]() | 1 ![]() | ![]() | ![]() | - |
| removeChild() | 1.5 ![]() | 5.0 ![]() | 6.0 ![]() | 5.0 ![]() | ![]() | ![]() | ![]() | 1 ![]() | ![]() | ![]() | - |
| replaceChild() | 1.5 ![]() | 5.0 ![]() | 6.0 ![]() | 5.0 ![]() | ![]() | ![]() | ![]() | 1 ![]() | ![]() | ![]() | - |
| Prev | Home | Next |
| news: URL | Up | Node.appendChild() |
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. | ||