DocumentType

The DocumentType interface represents a Node containing a doctype.

EventTarget Node DocumentType

Instance properties

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.

Instance methods

Inherits methods from its parent, Node.

DocumentType.after()

Inserts a set of Node objects or strings in the children list of the object's parent, just after this node.

DocumentType.before()

Inserts a set of Node objects or strings 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.

Specifications

Specification
DOM Standard
# interface-documenttype

Browser compatibility

BCD tables only load in the browser

See also