21.3. DOM Node Properties and Methods

The DOM includes several JavaScript bindings that can be used to navigate a document's DOM. A subset of those bindings, used in JavaScript as properties and methods, is listed in the following two tables. The first table describes JavaScript's properties.

A full list of DOM JavaScript bindings can be found on the W3C's Document Object Model Level 1 pages, at http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/ecma-script-language-binding.html.

PropertyDescription
attributesThis read-only property returns a named node mapNamedNodeMap containing the specified node's attributes.
childNodesThis read-only property returns a node list containing all the children of the specified node.
firstChildThis read-only property returns the first child node of the specified node.
lastChildThis read-only property returns the last child node of the specified node.
nextSiblingThis read-only property returns the next sibling of the specified node.
nodeNameThis read-only property returns a string containing the name of the node, which is typically the name of the element (P, DIV, TABLE, and so on).
nodeTypeThis read-only property returns a number corresponding to the node type (1 = element, 2 = text).
nodeValueThis property returns a string containing the contents of the node and is only valid for text nodes.
ownerDocumentThis read-only property returns the root document node object of the specified node.
parentNodeThis read-only property returns the parent node of the specified ...

Get Web Standards Programmer's Reference: HTML, CSS, JavaScript®, Perl, Python®, and PHP now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.