The base class for all documents.

Each web page loaded in the browser has its own Document object, which is typically an HtmlDocument.

If you aren't comfortable with DOM concepts, see the Dart tutorial Target 2: Connect Dart & HTML.

Inheritance
Implemented by
Annotations
  • @DocsEditable()
  • @DomName('Document')
  • @Native("Document")

Properties

activeElement Element
@DocsEditable(), @DomName('Document.activeElement'), @Experimental(), final
contentType String
@DocsEditable(), @DomName('Document.contentType'), @Experimental(), final
@DocsEditable(), @DomName('Document.cookie'), read / write
currentScript ScriptElement
@DocsEditable(), @DomName('Document.currentScript'), @Experimental(), final
documentElement Element
@DocsEditable(), @DomName('Document.documentElement'), final
domain String
@DocsEditable(), @DomName('Document.domain'), final
fonts FontFaceSet
@DocsEditable(), @DomName('Document.fonts'), @Experimental(), final
fullscreenElement Element
@DocsEditable(), @DomName('Document.fullscreenElement'), @Experimental(), final
fullscreenEnabled bool
@DocsEditable(), @DomName('Document.fullscreenEnabled'), @Experimental(), final
hidden bool
@DocsEditable(), @DomName('Document.hidden'), @Experimental(), final
implementation DomImplementation
@DocsEditable(), @DomName('Document.implementation'), final
onAbort Stream<Event>
Stream of abort events handled by this Document.
@DocsEditable(), @DomName('Document.onabort'), read-only
onBeforeCopy Stream<Event>
Stream of beforecopy events handled by this Document.
@DocsEditable(), @DomName('Document.onbeforecopy'), read-only
onBeforeCut Stream<Event>
Stream of beforecut events handled by this Document.
@DocsEditable(), @DomName('Document.onbeforecut'), read-only
onBeforePaste Stream<Event>
Stream of beforepaste events handled by this Document.
@DocsEditable(), @DomName('Document.onbeforepaste'), read-only
onBlur Stream<Event>
Stream of blur events handled by this Document.
@DocsEditable(), @DomName('Document.onblur'), read-only
onCanPlay Stream<Event>
@DocsEditable(), @DomName('Document.oncanplay'), @Experimental(), read-only
onCanPlayThrough Stream<Event>
@DocsEditable(), @DomName('Document.oncanplaythrough'), @Experimental(), read-only
onChange Stream<Event>
Stream of change events handled by this Document.
@DocsEditable(), @DomName('Document.onchange'), read-only
onClick Stream<MouseEvent>
Stream of click events handled by this Document.
@DocsEditable(), @DomName('Document.onclick'), read-only
onContextMenu Stream<MouseEvent>
Stream of contextmenu events handled by this Document.
@DocsEditable(), @DomName('Document.oncontextmenu'), read-only
onCopy Stream<ClipboardEvent>
Stream of copy events handled by this Document.
@DocsEditable(), @DomName('Document.oncopy'), read-only
onCut Stream<ClipboardEvent>
Stream of cut events handled by this Document.
@DocsEditable(), @DomName('Document.oncut'), read-only
onDoubleClick Stream<Event>
Stream of doubleclick events handled by this Document.
@DocsEditable(), @DomName('Document.ondblclick'), read-only
onDrag Stream<MouseEvent>
Stream of drag events handled by this Document.
@DocsEditable(), @DomName('Document.ondrag'), read-only
onDragEnd Stream<MouseEvent>
Stream of dragend events handled by this Document.
@DocsEditable(), @DomName('Document.ondragend'), read-only
onDragEnter Stream<MouseEvent>
Stream of dragenter events handled by this Document.
@DocsEditable(), @DomName('Document.ondragenter'), read-only
onDragLeave Stream<MouseEvent>
Stream of dragleave events handled by this Document.
@DocsEditable(), @DomName('Document.ondragleave'), read-only
onDragOver Stream<MouseEvent>
Stream of dragover events handled by this Document.
@DocsEditable(), @DomName('Document.ondragover'), read-only
onDragStart Stream<MouseEvent>
Stream of dragstart events handled by this Document.
@DocsEditable(), @DomName('Document.ondragstart'), read-only
onDrop Stream<MouseEvent>
Stream of drop events handled by this Document.
@DocsEditable(), @DomName('Document.ondrop'), read-only
onDurationChange Stream<Event>
@DocsEditable(), @DomName('Document.ondurationchange'), @Experimental(), read-only
onEmptied Stream<Event>
@DocsEditable(), @DomName('Document.onemptied'), @Experimental(), read-only
onEnded Stream<Event>
@DocsEditable(), @DomName('Document.onended'), @Experimental(), read-only
onError Stream<Event>
Stream of error events handled by this Document.
@DocsEditable(), @DomName('Document.onerror'), read-only
onFocus Stream<Event>
Stream of focus events handled by this Document.
@DocsEditable(), @DomName('Document.onfocus'), read-only
onFullscreenChange Stream<Event>
Stream of fullscreenchange events handled by this Document.
@DocsEditable(), @DomName('Document.onwebkitfullscreenchange'), @Experimental(), read-only
onFullscreenError Stream<Event>
Stream of fullscreenerror events handled by this Document.
@DocsEditable(), @DomName('Document.onwebkitfullscreenerror'), @Experimental(), read-only
onInput Stream<Event>
Stream of input events handled by this Document.
@DocsEditable(), @DomName('Document.oninput'), read-only
onInvalid Stream<Event>
Stream of invalid events handled by this Document.
@DocsEditable(), @DomName('Document.oninvalid'), read-only
onKeyDown Stream<KeyboardEvent>
Stream of keydown events handled by this Document.
@DocsEditable(), @DomName('Document.onkeydown'), read-only
onKeyPress Stream<KeyboardEvent>
Stream of keypress events handled by this Document.
@DocsEditable(), @DomName('Document.onkeypress'), read-only
onKeyUp Stream<KeyboardEvent>
Stream of keyup events handled by this Document.
@DocsEditable(), @DomName('Document.onkeyup'), read-only
onLoad Stream<Event>
Stream of load events handled by this Document.
@DocsEditable(), @DomName('Document.onload'), read-only
onLoadedData Stream<Event>
@DocsEditable(), @DomName('Document.onloadeddata'), @Experimental(), read-only
onLoadedMetadata Stream<Event>
@DocsEditable(), @DomName('Document.onloadedmetadata'), @Experimental(), read-only
onMouseDown Stream<MouseEvent>
Stream of mousedown events handled by this Document.
@DocsEditable(), @DomName('Document.onmousedown'), read-only
onMouseEnter Stream<MouseEvent>
Stream of mouseenter events handled by this Document.
@DocsEditable(), @DomName('Document.onmouseenter'), @Experimental(), read-only
onMouseLeave Stream<MouseEvent>
Stream of mouseleave events handled by this Document.
@DocsEditable(), @DomName('Document.onmouseleave'), @Experimental(), read-only
onMouseMove Stream<MouseEvent>
Stream of mousemove events handled by this Document.
@DocsEditable(), @DomName('Document.onmousemove'), read-only
onMouseOut Stream<MouseEvent>
Stream of mouseout events handled by this Document.
@DocsEditable(), @DomName('Document.onmouseout'), read-only
onMouseOver Stream<MouseEvent>
Stream of mouseover events handled by this Document.
@DocsEditable(), @DomName('Document.onmouseover'), read-only
onMouseUp Stream<MouseEvent>
Stream of mouseup events handled by this Document.
@DocsEditable(), @DomName('Document.onmouseup'), read-only
onMouseWheel Stream<WheelEvent>
Stream of mousewheel events handled by this Document.
@DocsEditable(), @DomName('Document.onmousewheel'), read-only
onPaste Stream<ClipboardEvent>
Stream of paste events handled by this Document.
@DocsEditable(), @DomName('Document.onpaste'), read-only
onPause Stream<Event>
@DocsEditable(), @DomName('Document.onpause'), @Experimental(), read-only
onPlay Stream<Event>
@DocsEditable(), @DomName('Document.onplay'), @Experimental(), read-only
onPlaying Stream<Event>
@DocsEditable(), @DomName('Document.onplaying'), @Experimental(), read-only
onPointerLockChange Stream<Event>
@DocsEditable(), @DomName('Document.onpointerlockchange'), @Experimental(), read-only
onPointerLockError Stream<Event>
@DocsEditable(), @DomName('Document.onpointerlockerror'), @Experimental(), read-only
onRateChange Stream<Event>
@DocsEditable(), @DomName('Document.onratechange'), @Experimental(), read-only
onReadyStateChange Stream<Event>
Stream of readystatechange events handled by this Document.
@DocsEditable(), @DomName('Document.onreadystatechange'), read-only
onReset Stream<Event>
Stream of reset events handled by this Document.
@DocsEditable(), @DomName('Document.onreset'), read-only
onResize Stream<Event>
@DocsEditable(), @DomName('Document.onresize'), @Experimental(), read-only
onScroll Stream<Event>
Stream of scroll events handled by this Document.
@DocsEditable(), @DomName('Document.onscroll'), read-only
onSearch Stream<Event>
Stream of search events handled by this Document.
@DocsEditable(), @DomName('Document.onsearch'), @Experimental(), read-only
onSecurityPolicyViolation Stream<SecurityPolicyViolationEvent>
Stream of securitypolicyviolation events handled by this Document.
@DocsEditable(), @DomName('Document.onsecuritypolicyviolation'), @Experimental(), read-only
onSeeked Stream<Event>
@DocsEditable(), @DomName('Document.onseeked'), @Experimental(), read-only
onSeeking Stream<Event>
@DocsEditable(), @DomName('Document.onseeking'), @Experimental(), read-only
onSelect Stream<Event>
Stream of select events handled by this Document.
@DocsEditable(), @DomName('Document.onselect'), read-only
onSelectionChange Stream<Event>
Stream of selectionchange events handled by this Document.
@DocsEditable(), @DomName('Document.onselectionchange'), read-only
onSelectStart Stream<Event>
Stream of selectstart events handled by this Document.
@DocsEditable(), @DomName('Document.onselectstart'), read-only
onStalled Stream<Event>
@DocsEditable(), @DomName('Document.onstalled'), @Experimental(), read-only
onSubmit Stream<Event>
Stream of submit events handled by this Document.
@DocsEditable(), @DomName('Document.onsubmit'), read-only
onSuspend Stream<Event>
@DocsEditable(), @DomName('Document.onsuspend'), @Experimental(), read-only
onTimeUpdate Stream<Event>
@DocsEditable(), @DomName('Document.ontimeupdate'), @Experimental(), read-only
onTouchCancel Stream<TouchEvent>
Stream of touchcancel events handled by this Document.
@DocsEditable(), @DomName('Document.ontouchcancel'), @Experimental(), read-only
onTouchEnd Stream<TouchEvent>
Stream of touchend events handled by this Document.
@DocsEditable(), @DomName('Document.ontouchend'), @Experimental(), read-only
onTouchMove Stream<TouchEvent>
Stream of touchmove events handled by this Document.
@DocsEditable(), @DomName('Document.ontouchmove'), @Experimental(), read-only
onTouchStart Stream<TouchEvent>
Stream of touchstart events handled by this Document.
@DocsEditable(), @DomName('Document.ontouchstart'), @Experimental(), read-only
onVolumeChange Stream<Event>
@DocsEditable(), @DomName('Document.onvolumechange'), @Experimental(), read-only
onWaiting Stream<Event>
@DocsEditable(), @DomName('Document.onwaiting'), @Experimental(), read-only
origin String
@DocsEditable(), @DomName('Document.origin'), @Experimental(), final
pointerLockElement Element
@DocsEditable(), @DomName('Document.pointerLockElement'), @Experimental(), final
readyState String
@DocsEditable(), @DomName('Document.readyState'), final
rootElement SvgSvgElement
@DocsEditable(), @DomName('Document.rootElement'), @Experimental(), final
scrollingElement Element
@DocsEditable(), @DomName('Document.scrollingElement'), @Experimental(), final
suborigin String
@DocsEditable(), @DomName('Document.suborigin'), @Experimental(), final
supportsRegister bool
Deprecated*: use supportsRegisterElement instead.
@deprecated, read-only
supportsRegisterElement bool
Checks if registerElement is supported on the current platform.
read-only
timeline AnimationTimeline
@DocsEditable(), @DomName('Document.timeline'), @Experimental(), final
visibilityState String
@DomName('Document.visibilityState'), @Experimental(), @SupportedBrowser(SupportedBrowser.CHROME), @SupportedBrowser(SupportedBrowser.FIREFOX), @SupportedBrowser(SupportedBrowser.IE, '10'), read-only
window WindowBase
@DocsEditable(), @DomName('Document.window'), @Experimental(), read-only
baseUri String
@DocsEditable(), @DomName('Node.baseURI'), @JSName('baseURI'), final, inherited
childNodes List<Node>
A list of this node's children. [...]
@Creates('NodeList'), @DocsEditable(), @DomName('Node.childNodes'), @Returns('NodeList'), final, inherited
firstChild Node
The first child of this node. [...]
@DocsEditable(), @DomName('Node.firstChild'), final, inherited
hashCode int
read-only, inherited
lastChild Node
The last child of this node. [...]
@DocsEditable(), @DomName('Node.lastChild'), final, inherited
nextNode Node
The next sibling node. [...]
@DocsEditable(), @DomName('Node.nextSibling'), @JSName('nextSibling'), final, inherited
nodeName String
The name of this node. [...]
@DocsEditable(), @DomName('Node.nodeName'), final, inherited
nodes Iterable<Node> value
A modifiable list of this node's children.
read / write, inherited
nodeType int
The type of node. [...]
@DocsEditable(), @DomName('Node.nodeType'), final, inherited
nodeValue String
The value of this node. [...]
@DocsEditable(), @DomName('Node.nodeValue'), final, inherited
on Events
This is an ease-of-use accessor for event streams which should only be used when an explicit accessor is not available.
read-only, inherited
ownerDocument Document
The document this node belongs to. [...]
@DocsEditable(), @DomName('Node.ownerDocument'), final, inherited
parent Element
The parent element of this node. [...]
@DocsEditable(), @DomName('Node.parentElement'), @JSName('parentElement'), final, inherited
parentNode Node
The parent node of this node. [...]
@DocsEditable(), @DomName('Node.parentNode'), final, inherited
previousNode Node
The previous sibling node. [...]
@DocsEditable(), @DomName('Node.previousSibling'), @JSName('previousSibling'), final, inherited
runtimeType Type
read-only, inherited
text String
All text within this node and its descendents. [...]
@DocsEditable(), @DomName('Node.textContent'), @JSName('textContent'), read / write, inherited
treeRoot Node
@DocsEditable(), @DomName('Node.treeRoot'), @Experimental(), final, inherited

Methods

adoptNode(Node node) Node
@DocsEditable(), @DomName('Document.adoptNode')
createDocumentFragment() DocumentFragment
@DocsEditable(), @DomName('Document.createDocumentFragment')
createElement(String tagName, [ String typeExtension ]) Element
@DomName('Document.createElement')
createElementNS(String namespaceURI, String qualifiedName, [ String typeExtension ]) Element
@DocsEditable(), @DomName('Document.createElementNS')
createRange() Range
@DocsEditable(), @DomName('Document.createRange')
elementsFromPoint(int x, int y) List<Element>
@DocsEditable(), @DomName('Document.elementsFromPoint'), @Experimental()
execCommand(String commandId, [ bool showUI, String value ]) bool
@DocsEditable(), @DomName('Document.execCommand')
exitFullscreen() → void
@DocsEditable(), @DomName('Document.exitFullscreen'), @Experimental()
exitPointerLock() → void
@DocsEditable(), @DomName('Document.exitPointerLock'), @Experimental()
getElementById(String elementId) Element
@DocsEditable(), @DomName('Document.getElementById')
getElementsByClassName(String classNames) List<Node>
@Creates('NodeList|HtmlCollection'), @DocsEditable(), @DomName('Document.getElementsByClassName'), @Returns('NodeList|HtmlCollection')
getElementsByName(String elementName) List<Node>
@Creates('NodeList|HtmlCollection'), @DocsEditable(), @DomName('Document.getElementsByName'), @Returns('NodeList|HtmlCollection')
getElementsByTagName(String localName) List<Node>
@Creates('NodeList|HtmlCollection'), @DocsEditable(), @DomName('Document.getElementsByTagName'), @Returns('NodeList|HtmlCollection')
importNode(Node node, [ bool deep ]) Node
@DocsEditable(), @DomName('Document.importNode')
query(String relativeSelectors) Element
Alias for querySelector. Note this function is deprecated because its semantics will be changing in the future.
@DomName('Document.querySelector'), @Experimental()
queryAll(String relativeSelectors) ElementList<Element>
Alias for querySelectorAll. Note this function is deprecated because its semantics will be changing in the future.
@DomName('Document.querySelectorAll'), @Experimental()
queryCommandEnabled(String commandId) bool
@DocsEditable(), @DomName('Document.queryCommandEnabled')
queryCommandIndeterm(String commandId) bool
@DocsEditable(), @DomName('Document.queryCommandIndeterm')
queryCommandState(String commandId) bool
@DocsEditable(), @DomName('Document.queryCommandState')
queryCommandSupported(String commandId) bool
@DocsEditable(), @DomName('Document.queryCommandSupported')
queryCommandValue(String commandId) String
@DocsEditable(), @DomName('Document.queryCommandValue')
querySelector(String selectors) Element
Finds the first descendant element of this document that matches the specified group of selectors. [...]
@DocsEditable(), @DomName('Document.querySelector')
querySelectorAll(String selectors) ElementList<Element>
Finds all descendant elements of this document that match the specified group of selectors. [...]
transformDocumentToTreeView(String noStyleMessage) → void
@DocsEditable(), @DomName('Document.transformDocumentToTreeView'), @Experimental()
addEventListener(String type, EventListener listener, [ bool useCapture ]) → void
inherited
append(Node node) Node
Adds a node to the end of the child nodes list of this node. [...]
@DocsEditable(), @DomName('Node.appendChild'), @JSName('appendChild'), inherited
clone(bool deep) Node
Returns a copy of this node. [...]
@DocsEditable(), @DomName('Node.cloneNode'), @JSName('cloneNode'), inherited
contains(Node other) bool
Returns true if this node contains the specified node. [...]
@DocsEditable(), @DomName('Node.contains'), inherited
dispatchEvent(Event event) bool
@DocsEditable(), @DomName('EventTarget.dispatchEvent'), inherited
hasChildNodes() bool
Returns true if this node has any children. [...]
@DocsEditable(), @DomName('Node.hasChildNodes'), inherited
insertAllBefore(Iterable<Node> newNodes, Node refChild) Node
Inserts all of the nodes into this node directly before refChild. [...]
inherited
insertBefore(Node node, Node child) Node
Inserts all of the nodes into this node directly before refChild. [...]
@DocsEditable(), @DomName('Node.insertBefore'), inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
remove() → void
Removes this node from the DOM.
@DomName('Node.removeChild'), inherited
removeEventListener(String type, EventListener listener, [ bool useCapture ]) → void
inherited
replaceWith(Node otherNode) Node
Replaces this node with another node.
@DomName('Node.replaceChild'), inherited
toString() String
Print out a String representation of this Node.
inherited

Operators

operator ==(other) bool
The equality operator. [...]
inherited

Constants

pointerLockChangeEvent EventStreamProvider<Event>
@DocsEditable(), @DomName('Document.pointerlockchangeEvent'), @Experimental()
const EventStreamProvider<Event>('pointerlockchange')
pointerLockErrorEvent EventStreamProvider<Event>
@DocsEditable(), @DomName('Document.pointerlockerrorEvent'), @Experimental()
const EventStreamProvider<Event>('pointerlockerror')
readyStateChangeEvent EventStreamProvider<Event>
Static factory designed to expose readystatechange events to event handlers that are not necessarily instances of Document. [...]
@DocsEditable(), @DomName('Document.readystatechangeEvent')
const EventStreamProvider<Event>('readystatechange')
securityPolicyViolationEvent EventStreamProvider<SecurityPolicyViolationEvent>
Static factory designed to expose securitypolicyviolation events to event handlers that are not necessarily instances of Document. [...]
@DocsEditable(), @DomName('Document.securitypolicyviolationEvent'), @Experimental()
selectionChangeEvent EventStreamProvider<Event>
Static factory designed to expose selectionchange events to event handlers that are not necessarily instances of Document. [...]
@DocsEditable(), @DomName('Document.selectionchangeEvent')
const EventStreamProvider<Event>('selectionchange')