NamedNodeMap

Non-standard
This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

Note: As of Gecko 22.0, this interface has been renamed to prefixed MozNamedAttrMap, as it has been removed from the spec and only available for Node.attributes. (bug 847195)

A collection of nodes returned by Node.attributes (also potentially for DocumentType.entities, DocumentType.notations). NamedNodeMaps are not in any particular order (unlike NodeList, although they may be accessed by an index as in an array (they may also be accessed with the item method). A NamedNodeMap object are live and will thus be auto-updated if changes are made to their contents internally or elsewhere.

Properties

NamedNodeMap.length (read-only integer)

Methods

Method Action Return
getNamedItem(nameStr) Gets a node by name Node
setNamedItem(node) Adds (or replaces) a node by its nodeName Node
removeNamedItem(nameStr) Removes a node (or if an attribute, may reveal a default if present) Node
item(idx) Returns the item at the given index (or null if the index is higher or equal to the number of nodes) Node
getNamedItemNS(namespaceURI, localName) Gets a node by namespaceURI and localName Node
setNamedItemNS(node) Adds (or replaces) a node by its localName and namespaceURI Node
removeNamedItemNS(namespaceURI, localName) Removes a node (or if an attribute, may reveal a default if present) Node

Specification

Document Tags and Contributors

Tags:
Contributors to this page: Sheppy, kscarfone, Brettz9, Prachi_Dighe, Yoshino, teoli, stepnem
Last updated by: kscarfone,