blob: 06c46e0ad9753bf626cec31d5ae5bce0c719ea28 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
---
title: Node.prefix
slug: conflicting/Web/API/Element/prefix
translation_of: Web/API/Node/prefix
original_slug: Web/API/Node/prefix
---
<div>
{{ApiRef}}</div>
<h2 id="Summary" name="Summary">概述</h2>
<p><code>prefix属性会</code>返回当前节点的命名空间前缀,如果没有指定命名空间前缀,则返回<code>null</code>,该属性只读.</p>
<h2 id="Syntax" name="Syntax">语法</h2>
<pre class="syntaxbox"><var>string</var> = element.prefix
</pre>
<h2 id="Examples" name="Examples">示例</h2>
<p>下面的代码将弹出"x".</p>
<pre class="brush:xml"><x:div onclick="alert(this.prefix)"/>
</pre>
<h2 id="Notes" name="Notes">附注</h2>
<p>该属性只在一个解析命名空间前缀的文档中可用,也就是说,只有在文档的MIME类型为XML,XHTML,XUL时可用,在HTML文档中不可用.</p>
<h2 id="Specification" name="Specification">规范</h2>
<ul>
<li><a href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-NodeNSPrefix">Node.prefix</a> (introduced in DOM2)</li>
</ul>
<h2 id="浏览器兼容性">浏览器兼容性</h2>
<div>
{{CompatibilityTable}}</div>
<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>{{CompatUnknown}}</td>
<td>
<p>{{CompatVersionUnknown}}</p>
<p>在Gecko 5.0 (Firefox 5.0 / Thunderbird 5.0 / SeaMonkey 2.2)之前,该属性是可写的; 之后,是只读的.</p>
</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>{{CompatUnknown}}</td>
<td>
<p>{{CompatVersionUnknown}}</p>
<p>P在Gecko 5.0 (Firefox 5.0 / Thunderbird 5.0 / SeaMonkey 2.2)之前,该属性是可写的; 之后,是只读的.</p>
</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatUnknown}}</td>
</tr>
</tbody>
</table>
</div>
<p></p>
|