docs.rodeo

MDN Web Docs mirror

Document

{{APIRef("DOM")}} 

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 {{HTMLElement("body")}}  and {{HTMLElement("table")}} , among many others. It provides functionality globally to the document, like how to obtain the page’s URL and create new elements in the document.

{{InheritanceDiagram}} 

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 {{DOMxRef("HTMLDocument")}}  interface, whereas XML and SVG documents implement the {{DOMxRef("XMLDocument")}}  interface.

Constructor

Instance properties

This interface also inherits from the {{DOMxRef("Node")}}  and {{DOMxRef("EventTarget")}}  interfaces.

Extensions for HTMLDocument

The Document interface for HTML documents inherits from the {{DOMxRef("HTMLDocument")}}  interface or is extended for such documents.

Deprecated properties

Instance methods

This interface also inherits from the {{DOMxRef("Node")}}  and {{DOMxRef("EventTarget")}}  interfaces.

The Document interface is extended with the {{DOMxRef("XPathEvaluator")}}  interface:

Extension for HTML documents

The Document interface for HTML documents inherit from the {{DOMxRef("HTMLDocument")}}  interface or is extended for such documents:

Static methods

This interface also inherits from the {{DOMxRef("Node")}}  and {{DOMxRef("EventTarget")}}  interfaces.

Events

Listen to these events using addEventListener() or by assigning an event listener to the oneventname property of this interface. In addition to the events listed below, many events can bubble from {{domxref("Node", "nodes", "", "nocode")}}  contained in the document tree.

Clipboard events

Fullscreen events

Load & unload events

Pointer lock events

Scroll events

Selection events

Bubbled events

Not all events that bubble can reach the Document object. Only the following do and can be listened for on the Document object:

Specifications

{{Specifications}} 

Browser compatibility

{{Compat}} 

In this article

View on MDN