The nodeType property is part of the browser's internal DOM management.
By inspecting the properties of various objects with an enumeration loop, you can determine some values for this property. If you know the node type, you may be able to take advantage of this when you write more sophisticated scripts. Here is a partial list of node types defined by the DOM specification:
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 standard is quite large at level 1 and defines a lot of ways in which you can traverse a document structure. The level 2 capabilities are even more extensive. Scripts than can understand node types and DOM document trees will be able to accomplish some amazingly powerful things.
See also: | Element object, Node.nodeType |
Prev | Home | Next |
Element.nodeName | Up | Element.nodeValue |
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. |