Name

DocumentType — the <!DOCTYPE> declaration of a document

Inherits from

Node

Synopsis

This infrequently used type represents the <!DOCTYPE> declaration of a document. The doctype property of a Document holds the DocumentType node for that document. DocumentType nodes are immutable and cannot be modified in any way.

DocumentType nodes are used to create new Document objects with DOMImplementation. create Document(). You can create new DocumentType objects with DOMImplementation.createDocumentType().

Properties

readonly string name

The name of the document type. This identifier immediately follows <!DOCTYPE> at the start of a document, and it is the same as the tag name of the document’s root element. For HTML documents, this will be “html”.

readonly string publicId

The public identifier of the DTD, or the empty string if none was specified.

readonly string systemId

The system identifier of the DTD, or the empty string if none was specified.

Get JavaScript: The Definitive Guide, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.