aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/attr/prefix
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/attr/prefix
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/attr/prefix')
-rw-r--r--files/zh-cn/web/api/attr/prefix/index.html67
1 files changed, 67 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/attr/prefix/index.html b/files/zh-cn/web/api/attr/prefix/index.html
new file mode 100644
index 0000000000..16215636ec
--- /dev/null
+++ b/files/zh-cn/web/api/attr/prefix/index.html
@@ -0,0 +1,67 @@
+---
+title: Attr.prefix
+slug: Web/API/Attr/prefix
+translation_of: Web/API/Attr/prefix
+---
+<div>{{APIRef("DOM")}}</div>
+
+<p><code><strong>Attr.prefix</strong></code> 为只读属性,返回指定标签属性的名字空间前缀,如果没有前缀则返回 <code>null</code>。</p>
+
+<div class="note">
+<p>在 DOM4 之前此 API 被定义在 {{domxref("Node")}} 接口中。</p>
+</div>
+
+<h2 id="语法">语法</h2>
+
+<pre class="syntaxbox notranslate"><var>string</var> = <var>attribute</var>.prefix
+</pre>
+
+<h2 id="示例">示例</h2>
+
+<p>下例在控制台中输出“x”。</p>
+
+<pre class="brush:xml notranslate">&lt;div x:id="example" onclick="console.log(this.attributes[0].prefix)"/&gt;
+</pre>
+
+<h2 id="注意">注意</h2>
+
+<p>该属性仅在使用有名字空间解析功能的解析器时有效,例如一个MIME类型为XML的文档。在HTML文档中无效。</p>
+
+<h2 id="规范">规范</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">规范</th>
+ <th scope="col">状态</th>
+ <th scope="col">备注</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName('DOM WHATWG', '#dom-attr-prefix', 'Attr: prefix')}}</td>
+ <td>{{Spec2('DOM WHATWG')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName("DOM4", "#dom-attr-prefix", "Attr.prefix")}}</td>
+ <td>{{Spec2("DOM4")}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+
+
+<p>{{Compat("api.Attr.prefix")}}</p>
+
+<h2 id="参考">参考</h2>
+
+<ul>
+ <li>{{domxref("Attr.namespaceURI")}}</li>
+ <li>{{domxref("Attr.localName")}}</li>
+ <li>{{domxref("Element.prefix")}}</li>
+ <li>{{domxref("Node.prefix")}}</li>
+</ul>