DocumentType
The DocumentType interface represents a Node containing a doctype.
Properties
Inherits properties from its parent, Node.
-
DocumentType.internalSubsetRead only -
A
DOMStringof the internal subset, ornullif there is none. Eg"<!ELEMENT foo (bar)>". -
DocumentType.nameRead only -
A
DOMString, eg"html"for<!DOCTYPE HTML>. -
DocumentType.notationsRead only -
A
NamedNodeMapwith notations declared in the DTD. -
DocumentType.publicIdRead only -
A
DOMString, eg"-//W3C//DTD HTML 4.01//EN", empty string for HTML5. -
DocumentType.systemIdRead only -
A
DOMString, eg"http://www.w3.org/TR/html4/strict.dtd", empty string for HTML5.
Methods
Inherits methods from its parent, Node.
DocumentType.after()-
Inserts a set of
NodeorDOMStringobjects in the children list of theDocumentType's parent, just after theDocumentTypeobject. DocumentType.before()-
Inserts a set of
NodeorDOMStringobjects in the children list of theDocumentType's parent, just before theDocumentTypeobject. DocumentType.remove()-
Removes the object from its parent children list.
DocumentType.replaceWith()-
Replaces the document type with a set of given nodes.
Specifications
| Specification |
|---|
| DOM Standard (DOM) # interface-documenttype |
Browser compatibility
| 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 |
1 |
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 |
entities |
1-34 |
12-79 |
1-6 |
9 |
≤12.1-21 |
3-10 |
1-37 |
18-34 |
4-6 |
≤12.1-21 |
1-10 |
1.0-2.0 |
internalSubset |
1-37 |
12-79 |
No |
9 |
≤12.1-24 |
3-10.1 |
1-37 |
18-37 |
No |
≤12.1-24 |
1-10.3 |
1.0-3.0 |
name |
1 |
12 |
1 |
9 |
≤12.1 |
3 |
1 |
18 |
4 |
≤12.1 |
1 |
1.0 |
notations |
1-34 |
12-79 |
1-6 |
9 |
≤12.1-21 |
3-10 |
1-37 |
18-34 |
4-6 |
≤12.1-21 |
1-10 |
1.0-2.0 |
publicId |
1 |
12 |
1 |
9 |
≤12.1 |
3 |
1 |
18 |
4 |
≤12.1 |
1 |
1.0 |
remove |
24 |
12 |
23 |
No |
15 |
7 |
≤37 |
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 |
1 |
18 |
4 |
≤12.1 |
1 |
1.0 |
See also
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/DocumentType