DocumentType
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
TheDocumentType interface represents aNode containing a doctype.
In this article
Instance properties
Inherits properties from its parent,Node.
DocumentType.nameRead onlyThe type of the document. It is always
"html"for HTML documents, but will vary for XML documents.DocumentType.publicIdRead onlyA string with an identifier of the type of document. Empty if the doctype given specifies no public ID.
DocumentType.systemIdRead onlyA string containing the URL to the associated DTD. Empty if the doctype given specifies no system ID.
Instance methods
Inherits methods from its parent,Node.
DocumentType.after()Inserts a set of
Nodeobjects or strings in the children list of theobject's parent, just after this node.DocumentType.before()Inserts a set of
Nodeobjects or strings in the children list of theobject'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.
Specifications
| Specification |
|---|
| DOM> # interface-documenttype> |
Browser compatibility
See also
- The DOM interfaces index.
DOMImplementation.createDocumentType()to create a newDocumentTypenode.