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.
Property | Description |
---|---|
attributes | This read-only property returns a named node mapNamedNodeMap containing the specified node's attributes. |
childNodes | This read-only property returns a node list containing all the children of the specified node. |
firstChild | This read-only property returns the first child node of the specified node. |
lastChild | This read-only property returns the last child node of the specified node. |
nextSibling | This read-only property returns the next sibling of the specified node. |
nodeName | This 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). |
nodeType | This read-only property returns a number corresponding to the node type (1 = element, 2 = text). |
nodeValue | This property returns a string containing the contents of the node and is only valid for text nodes. |
ownerDocument | This read-only property returns the root document node object of the specified node. |
parentNode | This 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.