--- title: DocumentType slug: Web/API/DocumentType tags: - API - DOM - DocumentType - Interface - 接口 translation_of: Web/API/DocumentType ---
{{APIRef("DOM")}}

DocumentType 接口表示了一个包含文档类型的节点 {{domxref("Node")}} .

{{InheritanceDiagram}}

属性

继承自父节点 {{domxref("Node")}}, 并实现了 {{domxref("ChildNode")}} 接口.

{{domxref("DocumentType.entities")}} {{readonlyInline}} {{obsolete_Inline}}
一个在文档类型定义(DTD)中声明的实体{{domxref("NamedNodeMap")}},在这个映射(map)中的每个节点实现了{{domxref("Entity")}}接口
{{domxref("DocumentType.internalSubset")}} {{readonlyInline}} {{obsolete_Inline}}
一个表示内部子集的{{domxref("DOMString")}},如果没有的话则为null ,例:"<!ELEMENT foo (bar)>"
{{domxref("DocumentType.name")}} {{readonlyInline}}
{{domxref("DOMString")}},文档类型的名称,例:<!DOCTYPE HTML>中的“html
{{domxref("DocumentType.notations")}} {{readonlyInline}} {{obsolete_Inline}}
在文档类型定义(DTD)中声明符号的{{domxref("NamedNodeMap")}},在这个映射(map)中的所有节点实现了{{domxref("Notation")}}接口
{{domxref("DocumentType.publicId")}} {{readonlyInline}}
一个{{domxref("DOMString")}},例:HTML5中的空字符串——"-//W3C//DTD HTML 4.01//EN"
{{domxref("DocumentType.systemId")}} {{readonlyInline}}
一个{{domxref("DOMString")}},例:HTML5中的空字符串—— "http://www.w3.org/TR/html4/strict.dtd"

方法

继承方法自父节点,{{domxref("Node")}}, 并实现了 {{domxref("ChildNode")}} 接口.

{{domxref("ChildNode.remove()")}} {{experimental_inline}}
从父节点的子节点的列表中移除这个对象.

规范

Specification Status Comment
{{SpecName('DOM WHATWG', '#documenttype', 'DocumentType')}} {{Spec2('DOM WHATWG')}} Added implemention of the {{domxref("ChildNode")}} interface.
Removed the internalSubset, entities, and notation properties.
{{SpecName('DOM3 Core', 'core.html#ID-412266927', 'DocumentType')}} {{Spec2('DOM3 Core')}} No change from {{SpecName('DOM2 Core')}}.
{{SpecName('DOM2 Core', 'core.html#ID-412266927', 'CharacterData')}} {{Spec2('DOM2 Core')}} Added the publicID, systemID, and internalSubset properties.
{{SpecName('DOM1', 'level-one-core.html#ID-412266927', 'CharacterData')}} {{Spec2('DOM1')}} Initial definition

浏览器兼容性

{{Compat("api.DocumentType")}}

参见