Name
NamedNodeMap — a collection of nodes indexed by name or position
Availability
DOM Level 1 Core
Properties
-
readonly unsigned long length
The number of nodes in the array.
Methods
-
getNamedItem( )
Looks up a named node.
-
getNamedItemNS( )
[DOM Level 2] Looks up a node specified by namespace and name.
-
item( )
Obtains the node at a specified position within the NamedNodeMap. In JavaScript, you can also do this by using the node position as an array index.
-
removeNamedItem( )
Deletes a named node from the NamedNodeMap.
-
removeNamedItemNS( )
[DOM Level 2] Deletes a node specified by name and namespace from the NamedNodeMap.
-
setNamedItem( )
Adds a new node to (or replaces an existing node in) the NamedNodeMap. The
nodeName
property of the Node object is used as the name of the node.-
setNamedItemNS( )
[DOM Level 2] Adds a new node to (or replaces an existing node in) the NamedNodeMap. The
namespaceURI
andlocalName
properties of the Node object are used as the node name.
Description
The NamedNodeMap interface defines a collection of nodes that may be
looked up by their nodeName
property or, for nodes
that use namespaces, by their namespaceURI
or
localName
properties.
The most notable use of the NamedNodeMap interface is the
attributes
property of the Node interface: a collection of Attr nodes that may be looked up by attribute name. Many of the methods of NamedNodeMap are similar to the methods of Element for manipulating attributes. Element attributes are usually most easily manipulated ...
Get JavaScript: The Definitive Guide, Fourth 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.