Name

Document: an HTML or XML document — DOM Level 1 Core: Node → Document

Subinterfaces

HTMLDocument

Properties

readonly Window defaultView

The web browser Window object (the “view” in DOM terminology) in which this document is displayed.

readonly DocumentType doctype

For XML documents with a <!DOCTYPE< declaration, specifies a DocumentType node that represents the document’s DTD. For HTML documents and for XML documents with no <!DOCTYPE>, this property is null.

readonly Element documentElement

A reference to the root element of the document. For HTML documents, this property is always the Element object representing the <html> tag. This root element is also available through the childNodes[] array inherited from Node. See also the body property of HTMLDocument.

readonly DOMImplementation implementation

The DOMImplementation object that represents the implementation that created this document.

readonly CSSStyleSheet[] styleSheets

A collection of objects representing all stylesheets embedded in or linked into a document. In HTML documents, this includes stylesheets defined with <link> and <style> tags.

Methods

addEventListener( )

Adds an event-handler function to the set of event handlers for this document. This is a DOM-standard method supported by all modern browsers except IE.

attachEvent( )

Adds an event-handler function to the set of handlers for this document. This is the IE-specific alternative to addEventListener( ).

createAttribute( )

Creates a new Attr node with ...

Get JavaScript: The Definitive Guide, 5th 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.