Document - Web APIs | MDN (original) (raw)
Baseline
Widely available *
The Document
interface represents any web page loaded in the browser and serves as an entry point into the web page's content, which is the DOM tree.
The DOM tree includes elements such as and
The Document
interface describes the common properties and methods for any kind of document. Depending on the document's type (e.g., HTML, XML, SVG, …), a larger API is available: HTML documents, served with the "text/html"
content type, also implement the HTMLDocument interface, whereas XML and SVG documents implement the XMLDocument interface.
Constructor
Creates a new Document
object.
Instance properties
This interface also inherits from the Node and EventTarget interfaces.
Document.activeElement Read only
Returns the Element that currently has focus.
Add an array of constructed stylesheets to be used by the document. These stylesheets may also be shared with shadow DOM subtrees of the same document.
Returns the or node of the current document.
Document.characterSet Read only
Returns the character set being used by the document.
Document.childElementCount Read only
Returns the number of child elements of the current document.
Document.children Read only
Returns the child elements of the current document.
Document.compatMode Read only
Indicates whether the document is rendered in quirks or strict mode.
Document.contentType Read only
Returns the Content-Type from the MIME Header of the current document.
Document.currentScript Read only