Node
Node
This page has been flagged with the following issues:
High-level issues:
W3C Recommendation
Summary
The interface for the primary data type for the entire Document Object Model.
Inherits from EventTarget
Overview
The Node interface is the primary datatype for the entire Document Object Model (DOM). It represents a single node in the document tree.
Properties
| API Name | Summary |
|---|---|
| attributes | Associatve array containing the attributes of node. |
| childNodes | |
| firstChild | |
| lastChild | |
| localName | Retrieves the local name of the fully qualified XML declaration for a node. |
| namespaceURI | Retrieves the namespace URI of the fully qualified XML declaration for a node. |
| nextSibling | Retrieves the next child node of the parent of the node. |
| nodeName | Gets the name of a particular type of node. |
| nodeType | Retrieves the type of the requested node. |
| nodeValue | Gets or sets the value of a node. |
| ownerDocument | |
| parentNode | Retrieves the parent node in the document hierarchy. |
| prefix | Sets or retrieves the prefix of the fully qualified XML declaration for a node. |
| previousSibling | Retrieves the previous child node of the parent of the node. |
| textContent | Sets or retrieves the text content of a node and any child nodes. |
Methods
| API Name | Summary |
|---|---|
| appendChild | Appends an element as a child to the object. |
| cloneNode | Copies a reference to the object from the document hierarchy. |
| compareDocumentPosition | Compares the position of two nodes in a document. |
| empty | |
| hasAttributes | |
| hasChildNodes | |
| insertBefore | Inserts a node into the document hierarchy as a child node of a node. |
| isDefaultNamespace | Indicates whether or not a namespace is the default namespace for a document. |
| isEqualNode | Determines whether two nodes are equal in their type, name and namespace. |
| isSameNode | Determines if two nodes are the same node. |
| isSupported | Returns a value indicating whether or not the object supports a specific DOM standard. |
| lookupNamespaceURI | Gets the URI of the namespace associated with a namespace prefix, if any. |
| lookupPrefix | Gets the namespace prefix associated with a URI, if any. |
| normalize | Merges adjacent DOM objects to produce a normalized document object model. |
| removeChild | Removes a child node from a node. |
| removeNode | Non standard. Proprietary. Use removeChild instead. Removes a node from the document hierarchy. |
| replaceChild | Replaces an existing child node with a new child node. |
| replaceNode | Non standard. Proprietary. Replaces the node with another node. |
| swapNode | Non standard. Proprietary. Exchanges the location of two nodes in the document hierarchy. |
Events
No events.
Inherited from EventTarget
Properties
No properties.
Methods
| API Name | Summary |
|---|---|
| addEventListener | Registers an event handler for the specified event type. |
| attachEvent | Non standard. Use addEventListener instead. Binds the specified function to an event, so that the function gets called whenever the event fires on the object. |
| detachEvent | Non standard. Use removeEventListener instead. Unbinds the specified function from the event, so that the function stops receiving notifications when the event fires. |
| dispatchEvent | Sends an event to the current element. |
| fireEvent | Non standard. Proprietary. Use dispatchEvent instead. Fires a specified event on the object. |
| removeEventListener | Removes an event handler that the addEventListener method registered. |
Events
No events.
Needs Examples: This section should include examples.
Notes
While all objects implementing the Node interface expose methods for dealing with children, not all objects implementing the Node interface may have children. For example, text nodes may not have children, and adding children to such nodes results in a DOMException. The attributes nodeName, nodeValue and attributes are included as a mechanism to get at node information without casting down to the specific derived interface. In cases where there is no obvious mapping of these attributes for a specific nodeType (i.e., nodeValue for an Element or attributes for a Comment), this returns null. Note that the specialized interfaces may contain additional and more convenient mechanisms to get and set the relevant information.
Related specifications
| Specification | Status | Related Changes |
|---|---|---|
| DOM Level 3 Core | Recommendation | Section 1.4 |
Compatibility
Desktop
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|
| Basic support | ? | ? | ? | ? | ? |
Mobile
| Feature | Android | BlackBerry | Chrome for mobile | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Opera Mini | Safari Mobile |
|---|---|---|---|---|---|---|---|---|
| Basic support | ? | ? | ? | ? | ? | ? | ? | ? |
See also
Related pages (MSDN)
This article contains content originally from external sources.
Portions of this content come from the Microsoft Developer Network: [Windows Internet Explorer API reference Article]
This tool helps to make and review comments inline.
How to Use
insert instructions, with images, here