Document

Contents

This is the window.document object.

<script>// <![CDATA[
document.write(document + "<br />");
for (x in document) {
    document.write("<b>" + x + " :</b> " + document[x] + "<br />");
}
// ]]></script>

[Firefox 47.0] Mozilla/5.0 (Windows NT 10.0; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0

[object HTMLDocument]

Interfaces

Node

interface Node {

  // NodeType
  const unsigned short      ELEMENT_NODE                   = 1;
  const unsigned short      ATTRIBUTE_NODE                 = 2;
  const unsigned short      TEXT_NODE                      = 3;
  const unsigned short      CDATA_SECTION_NODE             = 4;
  const unsigned short      ENTITY_REFERENCE_NODE          = 5;
  const unsigned short      ENTITY_NODE                    = 6;
  const unsigned short      PROCESSING_INSTRUCTION_NODE    = 7;
  const unsigned short      COMMENT_NODE                   = 8;
  const unsigned short      DOCUMENT_NODE                  = 9;
  const unsigned short      DOCUMENT_TYPE_NODE             = 10;
  const unsigned short      DOCUMENT_FRAGMENT_NODE         = 11;
  const unsigned short      NOTATION_NODE                  = 12;

  readonly attribute DOMString       nodeName;
           attribute DOMString       nodeValue;
                                        // raises(DOMException) on setting
                                        // raises(DOMException) on retrieval

  readonly attribute unsigned short  nodeType;
  readonly attribute Node            parentNode;
  readonly attribute NodeList        childNodes;
  readonly attribute Node            firstChild;
  readonly attribute Node            lastChild;
  readonly attribute Node            previousSibling;
  readonly attribute Node            nextSibling;
  readonly attribute NamedNodeMap    attributes;
  // Modified in DOM Level 2:
  readonly attribute Document        ownerDocument;
  // Modified in DOM Level 3:
  Node               insertBefore(in Node newChild, 
                                  in Node refChild)
                                        raises(DOMException);
  // Modified in DOM Level 3:
  Node               replaceChild(in Node newChild, 
                                  in Node oldChild)
                                        raises(DOMException);
  // Modified in DOM Level 3:
  Node               removeChild(in Node oldChild)
                                        raises(DOMException);
  // Modified in DOM Level 3:
  Node               appendChild(in Node newChild)
                                        raises(DOMException);
  boolean            hasChildNodes();
  Node               cloneNode(in boolean deep);
  // Modified in DOM Level 3:
  void               normalize();
  // Introduced in DOM Level 2:
  boolean            isSupported(in DOMString feature, 
                                 in DOMString version);
  // Introduced in DOM Level 2:
  readonly attribute DOMString       namespaceURI;
  // Introduced in DOM Level 2:
           attribute DOMString       prefix;
                                        // raises(DOMException) on setting

  // Introduced in DOM Level 2:
  readonly attribute DOMString       localName;
  // Introduced in DOM Level 2:
  boolean            hasAttributes();
  // Introduced in DOM Level 3:
  readonly attribute DOMString       baseURI;

  // DocumentPosition
  const unsigned short      DOCUMENT_POSITION_DISCONNECTED = 0x01;
  const unsigned short      DOCUMENT_POSITION_PRECEDING    = 0x02;
  const unsigned short      DOCUMENT_POSITION_FOLLOWING    = 0x04;
  const unsigned short      DOCUMENT_POSITION_CONTAINS     = 0x08;
  const unsigned short      DOCUMENT_POSITION_CONTAINED_BY = 0x10;
  const unsigned short      DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20;

  // Introduced in DOM Level 3:
  unsigned short     compareDocumentPosition(in Node other)
                                        raises(DOMException);
  // Introduced in DOM Level 3:
           attribute DOMString       textContent;
                                        // raises(DOMException) on setting
                                        // raises(DOMException) on retrieval

  // Introduced in DOM Level 3:
  boolean            isSameNode(in Node other);
  // Introduced in DOM Level 3:
  DOMString          lookupPrefix(in DOMString namespaceURI);
  // Introduced in DOM Level 3:
  boolean            isDefaultNamespace(in DOMString namespaceURI);
  // Introduced in DOM Level 3:
  DOMString          lookupNamespaceURI(in DOMString prefix);
  // Introduced in DOM Level 3:
  boolean            isEqualNode(in Node arg);
  // Introduced in DOM Level 3:
  DOMObject          getFeature(in DOMString feature, 
                                in DOMString version);
  // Introduced in DOM Level 3:
  DOMUserData        setUserData(in DOMString key, 
                                 in DOMUserData data, 
                                 in UserDataHandler handler);
  // Introduced in DOM Level 3:
  DOMUserData        getUserData(in DOMString key);
};

The Node interface is defined in DOM 3.

Document

interface Document : Node {
  // Modified in DOM Level 3:
  readonly attribute DocumentType    doctype;
  readonly attribute DOMImplementation implementation;
  readonly attribute Element         documentElement;
  Element            createElement(in DOMString tagName)
                                        raises(DOMException);
  DocumentFragment   createDocumentFragment();
  Text               createTextNode(in DOMString data);
  Comment            createComment(in DOMString data);
  CDATASection       createCDATASection(in DOMString data)
                                        raises(DOMException);
  ProcessingInstruction createProcessingInstruction(in DOMString target, 
                                                    in DOMString data)
                                        raises(DOMException);
  Attr               createAttribute(in DOMString name)
                                        raises(DOMException);
  EntityReference    createEntityReference(in DOMString name)
                                        raises(DOMException);
  NodeList           getElementsByTagName(in DOMString tagname);
  // Introduced in DOM Level 2:
  Node               importNode(in Node importedNode, 
                                in boolean deep)
                                        raises(DOMException);
  // Introduced in DOM Level 2:
  Element            createElementNS(in DOMString namespaceURI, 
                                     in DOMString qualifiedName)
                                        raises(DOMException);
  // Introduced in DOM Level 2:
  Attr               createAttributeNS(in DOMString namespaceURI, 
                                       in DOMString qualifiedName)
                                        raises(DOMException);
  // Introduced in DOM Level 2:
  NodeList           getElementsByTagNameNS(in DOMString namespaceURI, 
                                            in DOMString localName);
  // Introduced in DOM Level 2:
  Element            getElementById(in DOMString elementId);
  // Introduced in DOM Level 3:
  readonly attribute DOMString       inputEncoding;
  // Introduced in DOM Level 3:
  readonly attribute DOMString       xmlEncoding;
  // Introduced in DOM Level 3:
           attribute boolean         xmlStandalone;
                                        // raises(DOMException) on setting

  // Introduced in DOM Level 3:
           attribute DOMString       xmlVersion;
                                        // raises(DOMException) on setting

  // Introduced in DOM Level 3:
           attribute boolean         strictErrorChecking;
  // Introduced in DOM Level 3:
           attribute DOMString       documentURI;
  // Introduced in DOM Level 3:
  Node               adoptNode(in Node source)
                                        raises(DOMException);
  // Introduced in DOM Level 3:
  readonly attribute DOMConfiguration domConfig;
  // Introduced in DOM Level 3:
  void               normalizeDocument();
  // Introduced in DOM Level 3:
  Node               renameNode(in Node n, 
                                in DOMString namespaceURI, 
                                in DOMString qualifiedName)
                                        raises(DOMException);
};

The Document interface is defined in DOM 3.

Attributes

document.alinkColor

Property Type Value
alinkColor

document.baseURI

Property Type Value
baseURI

document.bgColor

Property Type Value
bgColor

document.characterSet

Property Type Value
characterSet

document.charset

Property Type Value
charset

document.childElementCount

Property Type Value
childElementCount

document.compatMode

Property Type Value
compatMode

document.contentType

Property Type Value
contentType

document.cookie

Property Type Value
cookie

document.designMode

Property Type Value
designMode

document.dir

Property Type Value
dir

document.documentURI

: http://ix23.com/?page_id=2228&preview=true

document.domain

: ix23.com

document.fgColor

:

document.hidden

: false

document.inputEncoding

: UTF-8

document.lastModified

: 06/16/2016 21:09:30

document.lastStyleSheetSet

: null

document.linkColor

:

document.localName

: null

document.location

: http://ix23.com/?page_id=2228&preview=true

document.mozFullScreen

: false

document.mozFullScreenElement

: null

document.mozFullScreenEnabled

: true

document.mozHidden

: false

document.mozPointerLockElement

: null

document.mozVisibilityState

: visible

document.namespaceURI

: null

document.nextSibling

: null

document.nodeName

: #document

document.nodeType

: 9

document.nodeValue

: null

document.ownerDocument

: null

document.parentElement

: null

document.parentNode

: null

document.preferredStyleSheetSet

:

document.prefix

: null

document.previousSibling

: null

document.readyState

: loading

document.referrer

: http://ix23.com/wp-admin/post.php?post=2228&action=edit

document.selectedStyleSheetSet

:

document.textContent

Property Type Value
textContent

document.title

Property Type Value
title

document.URL

Property Type Value
URL

document.visibilityState

Property Type Value
visibilityState

document.vlinkColor

Property Type Value
vlinkColor

Methods

addEventListener: function addEventListener() { [native code] }
adoptNode: function adoptNode() { [native code] }
appendChild: function appendChild() { [native code] }
captureEvents: function captureEvents() { [native code] }
caretPositionFromPoint: function caretPositionFromPoint() { [native code] }
clear: function clear() { [native code] }
cloneNode: function cloneNode() { [native code] }
close: function close() { [native code] }
compareDocumentPosition: function compareDocumentPosition() { [native code] }
contains: function contains() { [native code] }
createAttribute: function createAttribute() { [native code] }
createAttributeNS: function createAttributeNS() { [native code] }
createCDATASection: function createCDATASection() { [native code] }
createComment: function createComment() { [native code] }
createDocumentFragment: function createDocumentFragment() { [native code] }
createElement: function createElement() { [native code] }
createElementNS: function createElementNS() { [native code] }
createEvent: function createEvent() { [native code] }
createExpression: function createExpression() { [native code] }
createNodeIterator: function createNodeIterator() { [native code] }
createNSResolver: function createNSResolver() { [native code] }
createProcessingInstruction: function createProcessingInstruction() { [native code] }
createRange: function createRange() { [native code] }
createTextNode: function createTextNode() { [native code] }
createTreeWalker: function createTreeWalker() { [native code] }
dispatchEvent: function dispatchEvent() { [native code] }
elementFromPoint: function elementFromPoint() { [native code] }
elementsFromPoint: function elementsFromPoint() { [native code] }
enableStyleSheetsForSet: function enableStyleSheetsForSet() { [native code] }
evaluate: function evaluate() { [native code] }
execCommand: function execCommand() { [native code] }
getElementById: function getElementById() { [native code] }
getElementsByClassName: function getElementsByClassName() { [native code] }
getElementsByName: function getElementsByName() { [native code] }
getElementsByTagName: function getElementsByTagName() { [native code] }
getElementsByTagNameNS: function getElementsByTagNameNS() { [native code] }
getItems: function getItems() { [native code] }
getSelection: function getSelection() { [native code] }
hasChildNodes: function hasChildNodes() { [native code] }
hasFocus: function hasFocus() { [native code] }
importNode: function importNode() { [native code] }
insertBefore: function insertBefore() { [native code] }
isDefaultNamespace: function isDefaultNamespace() { [native code] }
isEqualNode: function isEqualNode() { [native code] }
lookupNamespaceURI: function lookupNamespaceURI() { [native code] }
lookupPrefix: function lookupPrefix() { [native code] }
mozCancelFullScreen: function mozCancelFullScreen() { [native code] }
mozExitPointerLock: function mozExitPointerLock() { [native code] }
mozSetImageElement: function mozSetImageElement() { [native code] }
normalize: function normalize() { [native code] }
open: function open() { [native code] }
queryCommandEnabled: function queryCommandEnabled() { [native code] }
queryCommandIndeterm: function queryCommandIndeterm() { [native code] }
queryCommandState: function queryCommandState() { [native code] }
queryCommandSupported: function queryCommandSupported() { [native code] }
queryCommandValue: function queryCommandValue() { [native code] }
querySelector: function querySelector() { [native code] }
querySelectorAll: function querySelectorAll() { [native code] }
releaseCapture: function releaseCapture() { [native code] }
releaseEvents: function releaseEvents() { [native code] }
removeChild: function removeChild() { [native code] }
removeEventListener: function removeEventListener() { [native code] }
replaceChild: function replaceChild() { [native code] }
write: function write() { [native code] }
writeln: function writeln() { [native code] }

Events

onabort: null
onafterscriptexecute: null
onbeforescriptexecute: null
onblur: null
oncanplay: null
oncanplaythrough: null
onchange: null
onclick: null
oncontextmenu: null
oncopy: null
oncut: null
ondblclick: null
ondrag: null
ondragend: null
ondragenter: null
ondragleave: null
ondragover: null
ondragstart: null
ondrop: null
ondurationchange: null
onemptied: null
onended: null
onerror: null
onfocus: null
oninput: null
oninvalid: null
onkeydown: null
onkeypress: null
onkeyup: null
onload: null
onloadeddata: null
onloadedmetadata: null
onloadstart: null
onmousedown: null
onmouseenter: null
onmouseleave: null
onmousemove: null
onmouseout: null
onmouseover: null
onmouseup: null
onmozfullscreenchange: null
onmozfullscreenerror: null
onmozpointerlockchange: null
onmozpointerlockerror: null
onpaste: null
onpause: null
onplay: null
onplaying: null
onprogress: null
onratechange: null
onreadystatechange: null
onreset: null
onresize: null
onscroll: null
onseeked: null
onseeking: null
onselect: null
onshow: null
onstalled: null
onsubmit: null
onsuspend: null
ontimeupdate: null
onvolumechange: null
onwaiting: null
onwheel: null

Objects

document.activeElement

<script>// <![CDATA[
document.write(document.activeElement + "<br />");
for (x in document.activeElement) {
    document.write("<b>" + x + " :</b> " + document.activeElement[x] + "<br />");
}
// ]]></script>

[object HTMLBodyElement]

document.all

<script>// <![CDATA[
document.write(document.all + "<br />");
for (x in document.all) {
    document.write("<b>" + x + " :</b> " + document.all[x] + "<br />");
}
// ]]></script>

[object HTMLAllCollection]

document.anchors

<script>// <![CDATA[
document.write(document.anchors + "<br />");
for (x in document.anchors) {
    document.write("<b>" + x + " :</b> " + document.anchors[x] + "<br />");
}
// ]]></script>

[object HTMLCollection]

document.applets

<script>// <![CDATA[
document.write(document.applets + "<br />");
for (x in document.applets) {
    document.write("<b>" + x + " :</b> " + document.applets[x] + "<br />");
}
// ]]></script>

[object HTMLCollection]

document.body

<script>// <![CDATA[
document.write(document.body + "<br />");
for (x in document.body) {
    document.write("<b>" + x + " :</b> " + document.body[x] + "<br />");
}
// ]]></script>

[object HTMLBodyElement]

document.childNodes

<script>// <![CDATA[
document.write(document.childNodes + "<br />");
for (x in document.childNodes) {
    document.write("<b>" + x + " :</b> " + document.childNodes[x] + "<br />");
}
// ]]></script>

[object NodeList]

document.children

: [object HTMLCollection]

document.currentScript

: [object HTMLScriptElement]

document.defaultView

: [object Window]

document.doctype

: [object DocumentType]

document.documentElement

: [object HTMLHtmlElement]

document.embeds

: [object HTMLCollection]

document.firstChild

: [object DocumentType]

document.firstElementChild

: [object HTMLHtmlElement]

document.fonts

<script>// <![CDATA[
document.write(document.fonts + "<br />");
for (x in document.fonts) {
    document.write("<b>" + x + " :</b> " + document.fonts[x] + "<br />");
}
// ]]></script>

[object FontFaceSet]

document.forms

<script>// <![CDATA[
document.write(document.forms + "<br />");
for (x in document.forms) {
    document.write("<b>" + x + " :</b> " + document.forms[x] + "<br />");
}
// ]]></script>

[object HTMLCollection]

document.head

<script>// <![CDATA[
document.write(document.head + "<br />");
for (x in document.head) {
    document.write("<b>" + x + " :</b> " + document.head[x] + "<br />");
}
// ]]></script>

[object HTMLHeadElement]

document.images

: [object HTMLCollection]

document.implementation

: [object DOMImplementation]

document.lastChild

: [object HTMLHtmlElement]

document.lastElementChild

: [object HTMLHtmlElement]

document.links

: [object HTMLCollection]

document.plugins

: [object HTMLCollection]

document.scripts

: [object HTMLCollection]

document.styleSheets

<script>// <![CDATA[
document.write(document.styleSheets + "<br />");
for (x in document.styleSheets) {
    document.write("<b>" + x + " :</b> " + document.styleSheets[x] + "<br />");
}
// ]]></script>

[object StyleSheetList]

[ArrayClass]
interface StyleSheetList {
    getter StyleSheet item(unsigned long index);
    readonly attribute unsigned long length;
};

Property Type Value
document.styleSheets.length unsigned long
document.styleSheets.item(0) StyleSheet

document.styleSheetSets

<script>// <![CDATA[
document.write(document.styleSheetSets + "<br />");
for (x in document.styleSheetSets) {
    document.write("<b>" + x + " :</b> " + document.styleSheetSets[x] + "<br />");
}
// ]]></script>

[object DOMStringList]

Constants

document.ATTRIBUTE_NODE

Property Type Value
ATTRIBUTE_NODE const unsigned short

document.CDATA_SECTION_NODE

Property Type Value
CDATA_SECTION_NODE const unsigned short

document.COMMENT_NODE

Property Type Value
COMMENT_NODE const unsigned short

document.DOCUMENT_FRAGMENT_NODE

Property Type Value
DOCUMENT_FRAGMENT_NODE const unsigned short

document.DOCUMENT_NODE

Property Type Value
DOCUMENT_NODE const unsigned short

document.DOCUMENT_POSITION_CONTAINED_BY

: 16

document.DOCUMENT_POSITION_CONTAINS

: 8

document.DOCUMENT_POSITION_DISCONNECTED

: 1

document.DOCUMENT_POSITION_FOLLOWING

: 4

document. DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC

: 32

document.DOCUMENT_POSITION_PRECEDING

: 2

document.DOCUMENT_TYPE_NODE

Property Type Value
DOCUMENT_TYPE_NODE const unsigned short

document.ELEMENT_NODE

Property Type Value
ELEMENT_NODE const unsigned short

document.ENTITY_NODE

Property Type Value
ENTITY_NODE const unsigned short

document.ENTITY_REFERENCE_NODE

Property Type Value
ENTITY_REFERENCE_NODE const unsigned short

document.NOTATION_NODE

Property Type Value
NOTATION_NODE const unsigned short

document.PROCESSING_INSTRUCTION_NODE

Property Type Value
PROCESSING_INSTRUCTION_NODE const unsigned short

document.TEXT_NODE

Property Type Value
TEXT_NODE const unsigned short

References

CSSOM Pieters, Simon. “CSS Object Model (CSSOM)”. Editor’s Draft. World Wide Web Consortium (W3C). June 17, 2016.

DOM 2 Style Wilson, Chris, ed. “Document Object Model (DOM) Level 2 Style Specification, Version 1.0”. W3C Recommendation. World Wide Web Consortium (W3C). November 13, 2000.

DOM 3 Le Hors, Arnaud. “Document Object Model (DOM) Level 3 Core Specification, Version 1.0”. W3C Recommendation. World Wide Web Consortium (W3C). April 7, 2004.

HTML 5 Hickson, Ian. “HTML5: A vocabulary and associated APIs for HTML and XHTML”. W3C Recommendation. World Wide Web Consortium (W3C). October 28, 2014.

Leave a Reply