Name
Node: a node in a document tree — DOM Level 1 Core
Subinterfaces
Attr, CDATASection, CharacterData, Comment, Document, DocumentFragment, DocumentType, Element, ProcessingInstruction, Text
Constants
All Node objects implement one of the subinterfaces
listed above. Every Node object has a nodeType
property that specifies which
subinterface it implements. These constants are the legal values for
that property; their names are self-explanatory. Note that these are
static properties of the Node( )
constructor function; they are not properties of individual Node
objects. Also note that they are not supported by Internet Explorer.
For compatibilty with IE, you must use numeric literals directly.
For example, use 1
instead of
Node.ELEMENT_NODE
:
Node.ELEMENT_NODE = 1; // Element Node.ATTRIBUTE_NODE = 2; // Attr Node.TEXT_NODE = 3; // Text Node.CDATA_SECTION_NODE = 4; // CDATASection Node.PROCESSING_INSTRUCTION_NODE = 7; // ProcessingInstruction Node.COMMENT_NODE = 8; // Comment Node.DOCUMENT_NODE = 9; // Document Node.DOCUMENT_TYPE_NODE = 10; // DocumentType Node.DOCUMENT_FRAGMENT_NODE = 11; // DocumentFragment
Properties
-
readonly Attr[] attributes
If this is an Element node, the
attributes
property is a read-only, array-like object of Attr nodes that represent the attributes of that element. Note that this array is “live”: any changes to the attributes of this element are immediately visible through it.Technically, the
attributes[]
array is a NamedNodeMap object. The NamedNodeMap interface ...
Get JavaScript: The Definitive Guide, 5th Edition 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.