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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
---
title: DocumentType
slug: Web/API/DocumentType
tags:
- API
- DOM
- DocumentType
- Interface
- 接口
translation_of: Web/API/DocumentType
---
<div>{{APIRef("DOM")}}</div>
<p><strong><code>DocumentType</code></strong> 接口表示了一个包含文档类型的节点 {{domxref("Node")}} .</p>
<p>{{InheritanceDiagram}}</p>
<h2 id="属性">属性</h2>
<p><em>继承自父节点 {{domxref("Node")}}, 并实现了 {{domxref("ChildNode")}} 接口.</em></p>
<dl>
<dt>{{domxref("DocumentType.entities")}} {{readonlyInline}} {{obsolete_Inline}}</dt>
<dd>一个在文档类型定义(DTD)中声明的实体{{domxref("NamedNodeMap")}},在这个映射(map)中的每个节点实现了{{domxref("Entity")}}接口</dd>
<dt>{{domxref("DocumentType.internalSubset")}} {{readonlyInline}} {{obsolete_Inline}}</dt>
<dd>一个表示内部子集的{{domxref("DOMString")}},如果没有的话则为<code>null</code> ,例:<code>"<!ELEMENT foo (bar)>"</code></dd>
<dt>{{domxref("DocumentType.name")}} {{readonlyInline}}</dt>
<dd>{{domxref("DOMString")}},文档类型的名称,例:<code><!DOCTYPE HTML></code>中的“<code>html</code>”</dd>
<dt>{{domxref("DocumentType.notations")}} {{readonlyInline}} {{obsolete_Inline}}</dt>
<dd>在文档类型定义(DTD)中声明符号的{{domxref("NamedNodeMap")}},在这个映射(map)中的所有节点实现了{{domxref("Notation")}}接口</dd>
<dt>{{domxref("DocumentType.publicId")}} {{readonlyInline}}</dt>
<dd>一个{{domxref("DOMString")}},例:HTML5中的空字符串——<code>"-//W3C//DTD HTML 4.01//EN"</code>。</dd>
<dt>{{domxref("DocumentType.systemId")}} {{readonlyInline}}</dt>
<dd>一个{{domxref("DOMString")}},例:HTML5中的空字符串—— <code>"http://www.w3.org/TR/html4/strict.dtd"</code>。</dd>
</dl>
<h2 id="方法">方法</h2>
<p><em>继承方法自父节点,{{domxref("Node")}}, 并实现了 {{domxref("ChildNode")}} 接口.</em></p>
<dl>
<dt>{{domxref("ChildNode.remove()")}} {{experimental_inline}}</dt>
<dd>从父节点的子节点的列表中移除这个对象.</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', '#documenttype', 'DocumentType')}}</td>
<td>{{Spec2('DOM WHATWG')}}</td>
<td>Added implemention of the {{domxref("ChildNode")}} interface.<br>
Removed the <code>internalSubset</code>, <code>entities</code>, and <code>notation</code> properties.</td>
</tr>
<tr>
<td>{{SpecName('DOM3 Core', 'core.html#ID-412266927', 'DocumentType')}}</td>
<td>{{Spec2('DOM3 Core')}}</td>
<td>No change from {{SpecName('DOM2 Core')}}.</td>
</tr>
<tr>
<td>{{SpecName('DOM2 Core', 'core.html#ID-412266927', 'CharacterData')}}</td>
<td>{{Spec2('DOM2 Core')}}</td>
<td>Added the <code>publicID</code>, <code>systemID</code>, and <code>internalSubset</code> properties.</td>
</tr>
<tr>
<td>{{SpecName('DOM1', 'level-one-core.html#ID-412266927', 'CharacterData')}}</td>
<td>{{Spec2('DOM1')}}</td>
<td>Initial definition</td>
</tr>
</tbody>
</table>
<h2 id="浏览器兼容性">浏览器兼容性</h2>
<p>{{Compat("api.DocumentType")}}</p>
<h2 id="参见">参见</h2>
<ul>
<li><a href="/zh-CN/docs/Web/API/Document_Object_Model#DOM_%E6%8E%A5%E5%8F%A3">DOM 接口索引</a></li>
<li>{{domxref("Entity")}}</li>
<li>{{domxref("Notation")}}</li>
</ul>
|