DocumentType
接口表示了一个包含文档类型的节点 Node
.
<div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="https://developer.mozilla.org/zh-CN/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="https://developer.mozilla.org/zh-CN/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Node</text></a><polyline points="226,25 236,20 236,30 226,25" stroke="#D4DDE4" fill="none"/><line x1="236" y1="25" x2="266" y2="25" stroke="#D4DDE4"/><a xlink:href="https://developer.mozilla.org/zh-CN/docs/Web/API/DocumentType" target="_top"><rect x="266" y="1" width="120" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="326" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">DocumentType</text></a></svg></div>
a:hover text { fill: #0095DD; pointer-events: all;}
属性
继承自父节点 Node
, 并实现了 ChildNode
接口.
DocumentType.entities
只读- 一个在文档类型定义(DTD)中声明的实体
NamedNodeMap
,在这个映射(map)中的每个节点实现了Entity
接口 DocumentType.internalSubset
只读- 一个表示内部子集的
DOMString
,如果没有的话则为null
,例:"<!ELEMENT foo (bar)>"
DocumentType.name
只读DOMString
,文档类型的名称,例:<!DOCTYPE HTML>
中的“html
”DocumentType.notations
只读- 在文档类型定义(DTD)中声明符号的
NamedNodeMap
,在这个映射(map)中的所有节点实现了Notation
接口 DocumentType.publicId
只读- 一个
DOMString
,例:HTML5中的空字符串——"-//W3C//DTD HTML 4.01//EN"
。 DocumentType.systemId
只读- 一个
DOMString
,例:HTML5中的空字符串——"http://www.w3.org/TR/html4/strict.dtd"
。
方法
继承方法自父节点,Node
, 并实现了 ChildNode
接口.
ChildNode.remove()
- 从父节点的子节点的列表中移除这个对象.
规范
Specification | Status | Comment |
---|---|---|
DOM DocumentType |
Living Standard | Added implemention of the ChildNode interface.Removed the internalSubset , entities , and notation properties. |
Document Object Model (DOM) Level 3 Core Specification DocumentType |
Obsolete | No change from Document Object Model (DOM) Level 2 Core Specification. |
Document Object Model (DOM) Level 2 Core Specification CharacterData |
Obsolete | Added the publicID , systemID , and internalSubset properties. |
Document Object Model (DOM) Level 1 Specification CharacterData |
Obsolete | Initial definition |
浏览器兼容性
BCD tables only load in the browser
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.