description

# Document class

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
  - Object
  - EventTarget
  - Node
  - Document
Implementers
  - HtmlDocument
  - XmlDocument
Annotations
  - @Native("Document")

## Constructors

Document()
  factory

## Properties

activeElement → Element
  final
addressSpace → String
  final
contentType → String
  final
cookie ↔ String
  read / write
currentScript → ScriptElement
  final
documentElement → Element
  final
domain → String
  final
fonts → FontFaceSet
  final
fullscreenElement → Element
  final
fullscreenEnabled → bool
  final
hidden → bool
  final
implementation → DomImplementation
  final
onAbort → Stream<Event>
  Stream of `abort` events handled by this Document.
  read-only
onBeforeCopy → Stream<Event>
  Stream of `beforecopy` events handled by this Document.
  read-only
onBeforeCut → Stream<Event>
  Stream of `beforecut` events handled by this Document.
  read-only
onBeforePaste → Stream<Event>
  Stream of `beforepaste` events handled by this Document.
  read-only
onBlur → Stream<Event>
  Stream of `blur` events handled by this Document.
  read-only
onCanPlay → Stream<Event>
  read-only
onCanPlayThrough → Stream<Event>
  read-only
onChange → Stream<Event>
  Stream of `change` events handled by this Document.
  read-only
onClick → Stream<MouseEvent>
  Stream of `click` events handled by this Document.
  read-only
onContextMenu → Stream<MouseEvent>
  Stream of `contextmenu` events handled by this Document.
  read-only
onCopy → Stream<ClipboardEvent>
  Stream of `copy` events handled by this Document.
  read-only
onCut → Stream<ClipboardEvent>
  Stream of `cut` events handled by this Document.
  read-only
onDoubleClick → Stream<Event>
  Stream of `doubleclick` events handled by this Document.
  @DomName('Document.ondblclick'), read-only
onDrag → Stream<MouseEvent>
  Stream of `drag` events handled by this Document.
  read-only
onDragEnd → Stream<MouseEvent>
  Stream of `dragend` events handled by this Document.
  read-only
onDragEnter → Stream<MouseEvent>
  Stream of `dragenter` events handled by this Document.
  read-only
onDragLeave → Stream<MouseEvent>
  Stream of `dragleave` events handled by this Document.
  read-only
onDragOver → Stream<MouseEvent>
  Stream of `dragover` events handled by this Document.
  read-only
onDragStart → Stream<MouseEvent>
  Stream of `dragstart` events handled by this Document.
  read-only
onDrop → Stream<MouseEvent>
  Stream of `drop` events handled by this Document.
  read-only
onDurationChange → Stream<Event>
  read-only
onEmptied → Stream<Event>
  read-only
onEnded → Stream<Event>
  read-only
onError → Stream<Event>
  Stream of `error` events handled by this Document.
  read-only
onFocus → Stream<Event>
  Stream of `focus` events handled by this Document.
  read-only
onFullscreenChange → Stream<Event>
  Stream of `fullscreenchange` events handled by this Document.
  read-only
onFullscreenError → Stream<Event>
  Stream of `fullscreenerror` events handled by this Document.
  read-only
onInput → Stream<Event>
  Stream of `input` events handled by this Document.
  read-only
onInvalid → Stream<Event>
  Stream of `invalid` events handled by this Document.
  read-only
onKeyDown → Stream<KeyboardEvent>
  Stream of `keydown` events handled by this Document.
  read-only
onKeyPress → Stream<KeyboardEvent>
  Stream of `keypress` events handled by this Document.
  read-only
onKeyUp → Stream<KeyboardEvent>
  Stream of `keyup` events handled by this Document.
  read-only
onLoad → Stream<Event>
  Stream of `load` events handled by this Document.
  read-only
onLoadedData → Stream<Event>
  read-only
onLoadedMetadata → Stream<Event>
  read-only
onMouseDown → Stream<MouseEvent>
  Stream of `mousedown` events handled by this Document.
  read-only
onMouseEnter → Stream<MouseEvent>
  Stream of `mouseenter` events handled by this Document.
  read-only
onMouseLeave → Stream<MouseEvent>
  Stream of `mouseleave` events handled by this Document.
  read-only
onMouseMove → Stream<MouseEvent>
  Stream of `mousemove` events handled by this Document.
  read-only
onMouseOut → Stream<MouseEvent>
  Stream of `mouseout` events handled by this Document.
  read-only
onMouseOver → Stream<MouseEvent>
  Stream of `mouseover` events handled by this Document.
  read-only
onMouseUp → Stream<MouseEvent>
  Stream of `mouseup` events handled by this Document.
  read-only
onMouseWheel → Stream<WheelEvent>
  Stream of `mousewheel` events handled by this Document.
  read-only
onPaste → Stream<ClipboardEvent>
  Stream of `paste` events handled by this Document.
  read-only
onPause → Stream<Event>
  read-only
onPlay → Stream<Event>
  read-only
onPlaying → Stream<Event>
  read-only
onPointerLockChange → Stream<Event>
  read-only
onPointerLockError → Stream<Event>
  read-only
onRateChange → Stream<Event>
  read-only
onReadyStateChange → Stream<Event>
  Stream of `readystatechange` events handled by this Document.
  read-only
onReset → Stream<Event>
  Stream of `reset` events handled by this Document.
  read-only
onResize → Stream<Event>
  read-only
onScroll → Stream<Event>
  Stream of `scroll` events handled by this Document.
  read-only
onSearch → Stream<Event>
  Stream of `search` events handled by this Document.
  read-only
onSecurityPolicyViolation → Stream<SecurityPolicyViolationEvent>
  Stream of `securitypolicyviolation` events handled by this Document.
  read-only
onSeeked → Stream<Event>
  read-only
onSeeking → Stream<Event>
  read-only
onSelect → Stream<Event>
  Stream of `select` events handled by this Document.
  read-only
onSelectionChange → Stream<Event>
  Stream of `selectionchange` events handled by this Document.
  read-only
onSelectStart → Stream<Event>
  Stream of `selectstart` events handled by this Document.
  read-only
onStalled → Stream<Event>
  read-only
onSubmit → Stream<Event>
  Stream of `submit` events handled by this Document.
  read-only
onSuspend → Stream<Event>
  read-only
onTimeUpdate → Stream<Event>
  read-only
onTouchCancel → Stream<TouchEvent>
  Stream of `touchcancel` events handled by this Document.
  read-only
onTouchEnd → Stream<TouchEvent>
  Stream of `touchend` events handled by this Document.
  read-only
onTouchMove → Stream<TouchEvent>
  Stream of `touchmove` events handled by this Document.
  read-only
onTouchStart → Stream<TouchEvent>
  Stream of `touchstart` events handled by this Document.
  read-only
onVolumeChange → Stream<Event>
  read-only
onWaiting → Stream<Event>
  read-only
origin → String
  final
pointerLockElement → Element
  final
readyState → String
  final
rootElement → SvgSvgElement
  final
rootScroller ↔ Element
  read / write
scrollingElement → Element
  final
suborigin → String
  final
supportsRegister → bool
  Deprecated: use supportsRegisterElement instead.
  read-only
supportsRegisterElement → bool
  Checks if registerElement is supported on the current platform.
  read-only
timeline → DocumentTimeline
  final
visibilityState → String
  @SupportedBrowser(SupportedBrowser.CHROME), @SupportedBrowser(SupportedBrowser.FIREFOX), @SupportedBrowser(SupportedBrowser.IE, '10'), read-only
window → WindowBase
  read-only
baseUri → String
  @JSName('baseURI'), final, inherited
childNodes → List<Node>
  A list of this node's children. [...]
  @Creates('NodeList'), @Returns('NodeList'), final, inherited
firstChild → Node
  The first child of this node. [...]
  final, inherited
hashCode → int
  The hash code for this object. [...]
  read-only, inherited
isConnected → bool
  final, inherited
lastChild → Node
  The last child of this node. [...]
  final, inherited
nextNode → Node
  The next sibling node. [...]
  @JSName('nextSibling'), final, inherited
nodeName → String
  The name of this node. [...]
  final, inherited
nodes ↔ List<Node>
  A modifiable list of this node's children.
  read / write, inherited
nodeType → int
  The type of node. [...]
  final, inherited
nodeValue → String
  The value of this node. [...]
  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. [...]
  final, inherited
parent → Element
  The parent element of this node. [...]
  @JSName('parentElement'), final, inherited
parentNode → Node
  The parent node of this node. [...]
  final, inherited
previousNode → Node
  The previous sibling node. [...]
  @JSName('previousSibling'), final, inherited
runtimeType → Type
  A representation of the runtime type of the object.
  read-only, inherited
text ↔ String
  All text within this node and its descendents. [...]
  @JSName('textContent'), read / write, inherited

## Methods

adoptNode(Node node) → Node
createDocumentFragment() → DocumentFragment
createElement(String tagName, [ String typeExtension ]) → Element
createElementNS(String namespaceURI, String qualifiedName, [ String typeExtension ]) → Element
createRange() → Range
elementsFromPoint(int x, int y) → List<Element>
execCommand(String commandId, [ bool showUI, String value ]) → bool
exitFullscreen() → void
exitPointerLock() → void
getAnimations() → List<Animation>
getElementById(String elementId) → Element
getElementsByClassName(String classNames) → List<Node>
  @Creates('NodeList|HtmlCollection'), @Returns('NodeList|HtmlCollection')
getElementsByName(String elementName) → List<Node>
  @Creates('NodeList|HtmlCollection'), @Returns('NodeList|HtmlCollection')
getElementsByTagName(String localName) → List<Node>
  @Creates('NodeList|HtmlCollection'), @Returns('NodeList|HtmlCollection')
importNode(Node node, [ bool deep ]) → Node
queryCommandEnabled(String commandId) → bool
queryCommandIndeterm(String commandId) → bool
queryCommandState(String commandId) → bool
queryCommandSupported(String commandId) → bool
queryCommandValue(String commandId) → String
querySelector(String selectors) → Element
  Finds the first descendant element of this document that matches the specified group of selectors. [...]
querySelectorAll<T extends Element>(String selectors) → ElementList<T>
  Finds all descendant elements of this document that match the specified group of selectors. [...]
registerElement(String tag, Type customElementClass, { String extendsTag }) → void
registerElement2(String type, [ Map options ]) → Function
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. [...]
  @JSName('appendChild'), inherited
clone(bool deep) → Node
  Returns a copy of this node. [...]
  @JSName('cloneNode'), inherited
contains(Node other) → bool
  Returns true if this node contains the specified node. [...]
  inherited
dispatchEvent(Event event) → bool
  inherited
getRootNode([Map options ]) → Node
  inherited
hasChildNodes() → bool
  Returns true if this node has any children. [...]
  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. [...]
  inherited
noSuchMethod(Invocation invocation) → dynamic
  Invoked when a non-existent method or property is accessed. [...]
  inherited
remove() → void
  Removes this node from the DOM.
  inherited
removeEventListener(String type, EventListener listener, [ bool useCapture ]) → void
  inherited
replaceWith(Node otherNode) → Node
  Replaces this node with another node.
  inherited
toString() → String
  Print out a String representation of this Node.
  inherited

## Operators

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

## Constants

pointerLockChangeEvent → const EventStreamProvider<Event>
  `const EventStreamProvider<Event>('pointerlockchange')`
pointerLockErrorEvent → const EventStreamProvider<Event>
  `const EventStreamProvider<Event>('pointerlockerror')`
readyStateChangeEvent → const EventStreamProvider<Event>
  Static factory designed to expose `readystatechange` events to event handlers that are not necessarily instances of Document. [...]
  `const EventStreamProvider<Event>('readystatechange')`
securityPolicyViolationEvent → const EventStreamProvider<SecurityPolicyViolationEvent>
  Static factory designed to expose `securitypolicyviolation` events to event handlers that are not necessarily instances of Document. [...]
  `const EventStreamProvider<SecurityPolicyViolationEvent>('securitypolicyviolation')`
selectionChangeEvent → const EventStreamProvider<Event>
  Static factory designed to expose `selectionchange` events to event handlers that are not necessarily instances of Document. [...]
  `const EventStreamProvider<Event>('selectionchange')`