aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/namednodemap/index.html
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/namednodemap/index.html
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/api/namednodemap/index.html')
-rw-r--r--files/zh-cn/web/api/namednodemap/index.html151
1 files changed, 151 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/namednodemap/index.html b/files/zh-cn/web/api/namednodemap/index.html
new file mode 100644
index 0000000000..19fc97780e
--- /dev/null
+++ b/files/zh-cn/web/api/namednodemap/index.html
@@ -0,0 +1,151 @@
+---
+title: NamedNodeMap
+slug: Web/API/NamedNodeMap
+translation_of: Web/API/NamedNodeMap
+---
+<div>{{APIRef}}</div>
+
+<p><code><strong>NamedNodeMap</strong></code> 接口表示属性节点 {{domxref("Attr")}} 对象的集合。尽管在 <code>NamedNodeMap</code> 里面的对象可以像数组一样通过索引来访问,但是它和 {{ domxref("NodeList") }} 不一样,对象的顺序没有指定。</p>
+
+<p><code>NamedNodeMap</code> 对象是即时的(<em>live</em>),因此,如果它内部包含的对象发生改变的话,该对象会自动更新到最新的状态。</p>
+
+<div class="note">
+<p>尽管被称为 <code>NamedNodeMap</code>,但这个接口不是用来处理节点对象({{domxref("Node")}}),而是用来处理属性节点对象({{domxref("Attr")}}),属性节点原来是一种特殊的节点({{domxref("Node")}}),仍然在某些实现环境(浏览器)中有效。</p>
+</div>
+
+<h2 id="属性">属性</h2>
+
+<p><em>该接口没有继承任何属性。</em></p>
+
+<dl>
+ <dt>{{ domxref("NamedNodeMap.length") }} {{ReadOnlyInline}}</dt>
+ <dd>返回映射(map)中对象的数量。</dd>
+</dl>
+
+<h2 id="方法">方法</h2>
+
+<p><em>该接口没有继承任何方法。</em></p>
+
+<dl>
+ <dt>{{domxref("NamedNodeMap.getNamedItem()")}}</dt>
+ <dd>返回一个给定名字对应的属性节点({{ domxref("Attr") }})。</dd>
+ <dt>{{domxref("NamedNodeMap.setNamedItem()")}}</dt>
+ <dd>替换或添加一个属性节点({{ domxref("Attr") }})到映射(map)中。</dd>
+ <dt>{{domxref("NamedNodeMap.removeNamedItem()")}}</dt>
+ <dd>移除一个属性节点({{ domxref("Attr") }})。</dd>
+ <dt>{{domxref("NamedNodeMap.item()")}}</dt>
+ <dd>返回指定索引处的属性节点({{ domxref("Attr") }}),或者,当索引超出或等于属性节点的数量时,返回 <code>null</code>。</dd>
+ <dt>{{domxref("NamedNodeMap.getNamedItemNS()")}}</dt>
+ <dd>根据给定的命名空间参数和name参数返回一个{{ domxref("Attr") }}对象。</dd>
+ <dt>{{domxref("NamedNodeMap.setNamedItemNS()")}}</dt>
+ <dd>替换、添加给定命名空间参数和name参数的{{ domxref("Attr") }} 对象 。</dd>
+ <dt>{{domxref("NamedNodeMap.removeNamedItemNS()")}}</dt>
+ <dd>删除给定命名空间参数和name参数的{{ domxref("Attr") }} 对象 。</dd>
+</dl>
+
+<h2 id="规范">规范</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('DOM WHATWG', '#interface-namednodemap', 'NamedNodeMap')}}</td>
+ <td>{{Spec2('DOM WHATWG')}}</td>
+ <td>Deals with {{domxref("Attr")}} instead of {{domxref("Node")}}</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('DOM3 Core', 'core.html#ID-1780488922', 'NamedNodeMap')}}</td>
+ <td>{{Spec2('DOM3 Core')}}</td>
+ <td>No change from {{SpecName('DOM2 Core')}}</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('DOM2 Core', 'core.html#ID-1780488922', 'NamedNodeMap')}}</td>
+ <td>{{Spec2('DOM2 Core')}}</td>
+ <td>Added <code>getNamedItemNS()</code>, <code>setNamedItemNS()</code> and <code>removeNamedItemNS()</code></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('DOM1', 'core.html#ID-1780488922', 'NamedNodeMap')}}</td>
+ <td>{{Spec2('DOM1')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+<p>{{ CompatibilityTable() }}</p>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{ CompatVersionUnknown() }}</td>
+ <td>{{ CompatVersionUnknown() }}</td>
+ <td>{{ CompatVersionUnknown() }}</td>
+ <td>{{ CompatVersionUnknown() }}</td>
+ <td>{{ CompatVersionUnknown() }}</td>
+ </tr>
+ <tr>
+ <td>Deals with {{domxref("Attr")}} rather than {{domxref("Node")}}</td>
+ <td>{{ CompatUnknown() }}</td>
+ <td>{{CompatGeckoDesktop(22)}} (but this interface was named <code>mozNamedAttrMap</code> to reflect this change)<br>
+ {{CompatGeckoDesktop(34)}} (interface named back to <code>NamedNodeMap</code>)<br>
+  </td>
+ <td>{{ CompatUnknown() }}</td>
+ <td>{{ CompatUnknown() }}</td>
+ <td>{{ CompatUnknown() }}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{ CompatVersionUnknown() }}</td>
+ <td>{{ CompatVersionUnknown() }}</td>
+ <td>{{ CompatVersionUnknown() }}</td>
+ <td>{{ CompatVersionUnknown() }}</td>
+ <td>{{ CompatVersionUnknown() }}</td>
+ </tr>
+ <tr>
+ <td>Deals with {{domxref("Attr")}} rather than {{domxref("Node")}}</td>
+ <td>{{ CompatUnknown() }}</td>
+ <td>{{CompatGeckoMobile(22)}} (but this interface was named <code>mozNamedAttrMap</code> to reflect this change)<br>
+ {{CompatGeckoMobile(34)}} (interface named back to <code>NamedNodeMap</code>)</td>
+ <td>{{ CompatUnknown() }}</td>
+ <td>{{ CompatUnknown() }}</td>
+ <td>{{ CompatUnknown() }}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="相关链接">相关链接</h2>
+
+<ul>
+ <li>{{ domxref("Element.attributes") }}</li>
+</ul>