The DocumentType
interface represents a Node
containing a doctype.
The DocumentType
interface represents a Node
containing a doctype.
Inherits properties from its parent, Node
.
DocumentType.name
Read only
The type of the document. It is always "html"
for HTML documents, but will vary for XML documents.
DocumentType.publicId
Read only
A string with an identifier of the type of document. Always empty (""
) for HTML, it will be, for example, "-//W3C//DTD SVG 1.1//EN"
for SVG documents.
DocumentType.systemId
Read only
A string containing the URL to the associated DTD. Always empty (""
) for HTML, it will be, for example, "http://www.w3.org/2000/svg"
for SVG documents.
Inherits methods from its parent, Node
.
DocumentType.after()
Inserts a set of Node
or string objects in the children list of the object's parent, just after this node.
DocumentType.before()
Inserts a set of Node
or string objects in the children list of the object's parent, just before this node.
DocumentType.remove()
Removes this object from its parent children list.
DocumentType.replaceWith()
Replaces the document type with a set of given nodes.
Specification |
---|
DOM Standard # interface-documenttype |
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
DocumentType |
1 | 12 | 1 | 9 | ≤12.1 | 3 | ≤37 | 18 | 4 | ≤12.1 | 1 | 1.0 |
after |
54 | 17 | 49 | No | 39 | 10 | 54 | 54 | 49 | 41 | 10 | 6.0 |
before |
54 | 17 | 49 | No | 39 | 10 | 54 | 54 | 49 | 41 | 10 | 6.0 |
name |
1 | 12 | 1 | 9 | ≤12.1 | 3 | 4.4 | 18 | 4 | ≤12.1 | 1 | 1.0 |
publicId |
1 | 12 | 1 | 9 | ≤12.1 | 3 | 4.4 | 18 | 4 | ≤12.1 | 1 | 1.0 |
remove |
24 | 12 | 23 | No | 15 | 7 | 4.4 | 25 | 23 | 14 | 7 | 1.5 |
replaceWith |
54 | 17 | 49 | No | 39 | 10 | 54 | 54 | 49 | 41 | 10 | 6.0 |
systemId |
1 | 12 | 1 | 9 | ≤12.1 | 3 | 4.4 | 18 | 4 | ≤12.1 | 1 | 1.0 |
DOMImplementation.createDocumentType()
to create a new DocumentType
node.
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/DocumentType