NamedNodeMap

  • Revision slug: Web/API/NamedNodeMap
  • Revision title: NamedNodeMap
  • Revision id: 436769
  • Created:
  • Creator: Yoshino
  • Is current revision? No
  • Comment

Revision Content

{{ Non-standard_header }}

{{ gecko_callout_heading(22) }}

This interface has been renamed to prefixed MozNamedAttrMap, as the interface has been removed from the spec and only available for {{ domxref("Node.attributes") }}. ({{ bug(847195) }})

A collection of nodes returned by {{ domxref("Node.attributes") }} (also potentially for {{ domxref("DocumentType.entities") }}, {{ domxref("DocumentType.notations") }}). NamedNodeMaps are not in any particular order (unlike {{ domxref("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

{{ domxref("NamedNodeMap.length") }} (read-only integer)

Methods

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

Specification

Revision Source

<div>
  {{ Non-standard_header }}</div>
<div class="geckoVersionNote">
  <p>{{ gecko_callout_heading(22) }}</p>
  <p>This interface has been renamed to prefixed <code>MozNamedAttrMap</code>, as the interface has been removed from the spec and only available for {{ domxref("Node.attributes") }}. ({{ bug(847195) }})</p>
</div>
<p>A collection of nodes returned by {{ domxref("Node.attributes") }} (also potentially for {{ domxref("DocumentType.entities") }}, {{ domxref("DocumentType.notations") }}). <code>NamedNodeMap</code>s are not in any particular order (unlike {{ domxref("NodeList") }}, although they may be accessed by an index as in an array (they may also be accessed with the <code>item</code> method). A <code>NamedNodeMap</code> object are live and will thus be auto-updated if changes are made to their contents internally or elsewhere.</p>
<h2 id="Properties">Properties</h2>
<p>{{ domxref("NamedNodeMap.length") }} (read-only integer)</p>
<h2 id="Methods">Methods</h2>
<table border="1" cellpadding="1" cellspacing="1" style="width: 100%;">
  <tbody>
    <tr>
      <td>Method</td>
      <td>Action</td>
      <td>Return</td>
    </tr>
    <tr>
      <td><code>getNamedItem(nameStr)</code></td>
      <td>Gets a node by name</td>
      <td>{{ domxref("Node") }}</td>
    </tr>
    <tr>
      <td><code>setNamedItem(node)</code></td>
      <td>Adds (or replaces) a node by its <code>nodeName</code></td>
      <td>{{ domxref("Node") }}</td>
    </tr>
    <tr>
      <td><code>removeNamedItem(nameStr)</code></td>
      <td>Removes a node (or if an attribute, may reveal a default if present)</td>
      <td>{{ domxref("Node") }}</td>
    </tr>
    <tr>
      <td><code>item(idx)</code></td>
      <td>Returns the item at the given index (or null if the index is higher or equal to the number of nodes)</td>
      <td>{{ domxref("Node") }}</td>
    </tr>
    <tr>
      <td><code>getNamedItemNS(namespaceURI, localName)</code></td>
      <td>Gets a node by <code>namespaceURI</code> and <code>localName</code></td>
      <td>{{ domxref("Node") }}</td>
    </tr>
    <tr>
      <td><code>setNamedItemNS(node)</code></td>
      <td>Adds (or replaces) a node by its <code>localName</code> and <code>namespaceURI</code></td>
      <td>{{ domxref("Node") }}</td>
    </tr>
    <tr>
      <td><code>removeNamedItemNS(namespaceURI, localName)</code></td>
      <td>Removes a node (or if an attribute, may reveal a default if present)</td>
      <td>{{ domxref("Node") }}</td>
    </tr>
  </tbody>
</table>
<h2 id="Specification">Specification</h2>
<ul>
  <li><a href="http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-1780488922">http://www.w3.org/TR/DOM-Level-3-Cor...#ID-1780488922</a></li>
</ul>
Revert to this revision