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
Implemented by
Annotations
  • @DocsEditable()
  • @DomName('Document')

Constants

pointerLockChangeEventEventStreamProvider<Event>
@DocsEditable(), @DomName('Document.pointerlockchangeEvent'), @Experimental()
const EventStreamProvider<Event>('pointerlockchange')
pointerLockErrorEventEventStreamProvider<Event>
@DocsEditable(), @DomName('Document.pointerlockerrorEvent'), @Experimental()
const EventStreamProvider<Event>('pointerlockerror')
readyStateChangeEventEventStreamProvider<Event>
@DocsEditable(), @DomName('Document.readystatechangeEvent')

Static factory designed to expose readystatechange events to event handlers that are not necessarily instances of Document.

const EventStreamProvider<Event>('readystatechange')
securityPolicyViolationEventEventStreamProvider<SecurityPolicyViolationEvent>
@DocsEditable(), @DomName('Document.securitypolicyviolationEvent'), @Experimental()

Static factory designed to expose securitypolicyviolation events to event handlers that are not necessarily instances of Document.

selectionChangeEventEventStreamProvider<Event>
@DocsEditable(), @DomName('Document.selectionchangeEvent')

Static factory designed to expose selectionchange events to event handlers that are not necessarily instances of Document.

const EventStreamProvider<Event>('selectionchange')

Static Properties

instanceRuntimeTypeType
@Deprecated("Internal Use Only"), read-only

Constructors

Document.internal_()

Properties

activeElementElement
@DocsEditable(), @DomName('Document.activeElement'), @Experimental(), read-only
contentTypeString
@DocsEditable(), @DomName('Document.contentType'), @Experimental(), read-only
currentScriptScriptElement
@DocsEditable(), @DomName('Document.currentScript'), @Experimental(), read-only
documentElementElement
@DocsEditable(), @DomName('Document.documentElement'), read-only
domainString
@DocsEditable(), @DomName('Document.domain'), read-only
fontsFontFaceSet
@DocsEditable(), @DomName('Document.fonts'), @Experimental(), read-only
fullscreenElementElement
@DocsEditable(), @DomName('Document.fullscreenElement'), @Experimental(), read-only
fullscreenEnabledbool
@DocsEditable(), @DomName('Document.fullscreenEnabled'), @Experimental(), read-only
hiddenbool
@DocsEditable(), @DomName('Document.hidden'), @Experimental(), read-only
implementationDomImplementation
@DocsEditable(), @DomName('Document.implementation'), read-only
onAbortStream<Event>
@DocsEditable(), @DomName('Document.onabort'), read-only

Stream of abort events handled by this Document.

onBeforeCopyStream<Event>
@DocsEditable(), @DomName('Document.onbeforecopy'), read-only

Stream of beforecopy events handled by this Document.

onBeforeCutStream<Event>
@DocsEditable(), @DomName('Document.onbeforecut'), read-only

Stream of beforecut events handled by this Document.

onBeforePasteStream<Event>
@DocsEditable(), @DomName('Document.onbeforepaste'), read-only

Stream of beforepaste events handled by this Document.

onBlurStream<Event>
@DocsEditable(), @DomName('Document.onblur'), read-only

Stream of blur events handled by this Document.

onCanPlayStream<Event>
@DocsEditable(), @DomName('Document.oncanplay'), @Experimental(), read-only
onCanPlayThroughStream<Event>
@DocsEditable(), @DomName('Document.oncanplaythrough'), @Experimental(), read-only
onChangeStream<Event>
@DocsEditable(), @DomName('Document.onchange'), read-only

Stream of change events handled by this Document.

onClickStream<MouseEvent>
@DocsEditable(), @DomName('Document.onclick'), read-only

Stream of click events handled by this Document.

onContextMenuStream<MouseEvent>
@DocsEditable(), @DomName('Document.oncontextmenu'), read-only

Stream of contextmenu events handled by this Document.

onCopyStream<ClipboardEvent>
@DocsEditable(), @DomName('Document.oncopy'), read-only

Stream of copy events handled by this Document.

onCutStream<ClipboardEvent>
@DocsEditable(), @DomName('Document.oncut'), read-only

Stream of cut events handled by this Document.

onDoubleClickStream<Event>
@DocsEditable(), @DomName('Document.ondblclick'), read-only

Stream of doubleclick events handled by this Document.

onDragStream<MouseEvent>
@DocsEditable(), @DomName('Document.ondrag'), read-only

Stream of drag events handled by this Document.

onDragEndStream<MouseEvent>
@DocsEditable(), @DomName('Document.ondragend'), read-only

Stream of dragend events handled by this Document.

onDragEnterStream<MouseEvent>
@DocsEditable(), @DomName('Document.ondragenter'), read-only

Stream of dragenter events handled by this Document.

onDragLeaveStream<MouseEvent>
@DocsEditable(), @DomName('Document.ondragleave'), read-only

Stream of dragleave events handled by this Document.

onDragOverStream<MouseEvent>
@DocsEditable(), @DomName('Document.ondragover'), read-only

Stream of dragover events handled by this Document.

onDragStartStream<MouseEvent>
@DocsEditable(), @DomName('Document.ondragstart'), read-only

Stream of dragstart events handled by this Document.

onDropStream<MouseEvent>
@DocsEditable(), @DomName('Document.ondrop'), read-only

Stream of drop events handled by this Document.

onDurationChangeStream<Event>
@DocsEditable(), @DomName('Document.ondurationchange'), @Experimental(), read-only
onEmptiedStream<Event>
@DocsEditable(), @DomName('Document.onemptied'), @Experimental(), read-only
onEndedStream<Event>
@DocsEditable(), @DomName('Document.onended'), @Experimental(), read-only
onErrorStream<Event>
@DocsEditable(), @DomName('Document.onerror'), read-only

Stream of error events handled by this Document.

onFocusStream<Event>
@DocsEditable(), @DomName('Document.onfocus'), read-only

Stream of focus events handled by this Document.

onFullscreenChangeStream<Event>
@DocsEditable(), @DomName('Document.onwebkitfullscreenchange'), @Experimental(), read-only

Stream of fullscreenchange events handled by this Document.

onFullscreenErrorStream<Event>
@DocsEditable(), @DomName('Document.onwebkitfullscreenerror'), @Experimental(), read-only

Stream of fullscreenerror events handled by this Document.

onInputStream<Event>
@DocsEditable(), @DomName('Document.oninput'), read-only

Stream of input events handled by this Document.

onInvalidStream<Event>
@DocsEditable(), @DomName('Document.oninvalid'), read-only

Stream of invalid events handled by this Document.

onKeyDownStream<KeyboardEvent>
@DocsEditable(), @DomName('Document.onkeydown'), read-only

Stream of keydown events handled by this Document.

onKeyPressStream<KeyboardEvent>
@DocsEditable(), @DomName('Document.onkeypress'), read-only

Stream of keypress events handled by this Document.

onKeyUpStream<KeyboardEvent>
@DocsEditable(), @DomName('Document.onkeyup'), read-only

Stream of keyup events handled by this Document.

onLoadStream<Event>
@DocsEditable(), @DomName('Document.onload'), read-only

Stream of load events handled by this Document.

onLoadedDataStream<Event>
@DocsEditable(), @DomName('Document.onloadeddata'), @Experimental(), read-only
onLoadedMetadataStream<Event>
@DocsEditable(), @DomName('Document.onloadedmetadata'), @Experimental(), read-only
onMouseDownStream<MouseEvent>
@DocsEditable(), @DomName('Document.onmousedown'), read-only

Stream of mousedown events handled by this Document.

onMouseEnterStream<MouseEvent>
@DocsEditable(), @DomName('Document.onmouseenter'), @Experimental(), read-only

Stream of mouseenter events handled by this Document.

onMouseLeaveStream<MouseEvent>
@DocsEditable(), @DomName('Document.onmouseleave'), @Experimental(), read-only

Stream of mouseleave events handled by this Document.

onMouseMoveStream<MouseEvent>
@DocsEditable(), @DomName('Document.onmousemove'), read-only

Stream of mousemove events handled by this Document.

onMouseOutStream<MouseEvent>
@DocsEditable(), @DomName('Document.onmouseout'), read-only

Stream of mouseout events handled by this Document.

onMouseOverStream<MouseEvent>
@DocsEditable(), @DomName('Document.onmouseover'), read-only

Stream of mouseover events handled by this Document.

onMouseUpStream<MouseEvent>
@DocsEditable(), @DomName('Document.onmouseup'), read-only

Stream of mouseup events handled by this Document.

onMouseWheelStream<WheelEvent>
@DocsEditable(), @DomName('Document.onmousewheel'), read-only

Stream of mousewheel events handled by this Document.

onPasteStream<ClipboardEvent>
@DocsEditable(), @DomName('Document.onpaste'), read-only

Stream of paste events handled by this Document.

onPauseStream<Event>
@DocsEditable(), @DomName('Document.onpause'), @Experimental(), read-only
onPlayStream<Event>
@DocsEditable(), @DomName('Document.onplay'), @Experimental(), read-only
onPlayingStream<Event>
@DocsEditable(), @DomName('Document.onplaying'), @Experimental(), read-only
onPointerLockChangeStream<Event>
@DocsEditable(), @DomName('Document.onpointerlockchange'), @Experimental(), read-only
onPointerLockErrorStream<Event>
@DocsEditable(), @DomName('Document.onpointerlockerror'), @Experimental(), read-only
onRateChangeStream<Event>
@DocsEditable(), @DomName('Document.onratechange'), @Experimental(), read-only
onReadyStateChangeStream<Event>
@DocsEditable(), @DomName('Document.onreadystatechange'), read-only

Stream of readystatechange events handled by this Document.

onResetStream<Event>
@DocsEditable(), @DomName('Document.onreset'), read-only

Stream of reset events handled by this Document.

onResizeStream<Event>
@DocsEditable(), @DomName('Document.onresize'), @Experimental(), read-only
onScrollStream<Event>
@DocsEditable(), @DomName('Document.onscroll'), read-only

Stream of scroll events handled by this Document.

onSearchStream<Event>
@DocsEditable(), @DomName('Document.onsearch'), @Experimental(), read-only

Stream of search events handled by this Document.

onSecurityPolicyViolationStream<SecurityPolicyViolationEvent>
@DocsEditable(), @DomName('Document.onsecuritypolicyviolation'), @Experimental(), read-only

Stream of securitypolicyviolation events handled by this Document.

onSeekedStream<Event>
@DocsEditable(), @DomName('Document.onseeked'), @Experimental(), read-only
onSeekingStream<Event>
@DocsEditable(), @DomName('Document.onseeking'), @Experimental(), read-only
onSelectStream<Event>
@DocsEditable(), @DomName('Document.onselect'), read-only

Stream of select events handled by this Document.

onSelectionChangeStream<Event>
@DocsEditable(), @DomName('Document.onselectionchange'), read-only

Stream of selectionchange events handled by this Document.

onSelectStartStream<Event>
@DocsEditable(), @DomName('Document.onselectstart'), read-only

Stream of selectstart events handled by this Document.

onStalledStream<Event>
@DocsEditable(), @DomName('Document.onstalled'), @Experimental(), read-only
onSubmitStream<Event>
@DocsEditable(), @DomName('Document.onsubmit'), read-only

Stream of submit events handled by this Document.

onSuspendStream<Event>
@DocsEditable(), @DomName('Document.onsuspend'), @Experimental(), read-only
onTimeUpdateStream<Event>
@DocsEditable(), @DomName('Document.ontimeupdate'), @Experimental(), read-only
onTouchCancelStream<TouchEvent>
@DocsEditable(), @DomName('Document.ontouchcancel'), @Experimental(), read-only

Stream of touchcancel events handled by this Document.

onTouchEndStream<TouchEvent>
@DocsEditable(), @DomName('Document.ontouchend'), @Experimental(), read-only

Stream of touchend events handled by this Document.

onTouchMoveStream<TouchEvent>
@DocsEditable(), @DomName('Document.ontouchmove'), @Experimental(), read-only

Stream of touchmove events handled by this Document.

onTouchStartStream<TouchEvent>
@DocsEditable(), @DomName('Document.ontouchstart'), @Experimental(), read-only

Stream of touchstart events handled by this Document.

onVolumeChangeStream<Event>
@DocsEditable(), @DomName('Document.onvolumechange'), @Experimental(), read-only
onWaitingStream<Event>
@DocsEditable(), @DomName('Document.onwaiting'), @Experimental(), read-only
originString
@DocsEditable(), @DomName('Document.origin'), @Experimental(), read-only
pointerLockElementElement
@DocsEditable(), @DomName('Document.pointerLockElement'), @Experimental(), read-only
readyStateString
@DocsEditable(), @DomName('Document.readyState'), read-only
rootElementSvgSvgElement
@DocsEditable(), @DomName('Document.rootElement'), @Experimental(), read-only
scrollingElementElement
@DocsEditable(), @DomName('Document.scrollingElement'), @Experimental(), read-only
suboriginString
@DocsEditable(), @DomName('Document.suborigin'), @Experimental(), read-only
supportsRegisterbool
@deprecated, read-only

Deprecated*: use supportsRegisterElement instead.

supportsRegisterElementbool
read-only

Checks if registerElement is supported on the current platform.

timelineAnimationTimeline
@DocsEditable(), @DomName('Document.timeline'), @Experimental(), read-only
visibilityStateString
@DomName('Document.visibilityState'), @Experimental(), @SupportedBrowser(SupportedBrowser.CHROME), @SupportedBrowser(SupportedBrowser.FIREFOX), @SupportedBrowser(SupportedBrowser.IE, '10'), read-only
windowWindowBase
@DocsEditable(), @DomName('Document.defaultView'), read-only
baseUriString
@DocsEditable(), @DomName('Node.baseURI'), read-only, inherited
childNodesList<Node>
@DocsEditable(), @DomName('Node.childNodes'), read-only, inherited

A list of this node's children.

firstChildNode
@DocsEditable(), @DomName('Node.firstChild'), read-only, inherited

The first child of this node.

hashCodeint
read-only, inherited
lastChildNode
@DocsEditable(), @DomName('Node.lastChild'), read-only, inherited

The last child of this node.

nextNodeNode
@DocsEditable(), @DomName('Node.nextSibling'), read-only, inherited

The next sibling node.

nodeNameString
@DocsEditable(), @DomName('Node.nodeName'), read-only, inherited

The name of this node.

nodesList<Node>
read / write, inherited

A modifiable list of this node's children.

nodeTypeint
@DocsEditable(), @DomName('Node.nodeType'), read-only, inherited

The type of node.

nodeValueString
@DocsEditable(), @DomName('Node.nodeValue'), read-only, inherited

The value of this node.

onEvents
read-only, inherited

This is an ease-of-use accessor for event streams which should only be used when an explicit accessor is not available.

ownerDocumentDocument
@DocsEditable(), @DomName('Node.ownerDocument'), read-only, inherited

The document this node belongs to.

parentElement
@DocsEditable(), @DomName('Node.parentElement'), read-only, inherited

The parent element of this node.

parentNodeNode
@DocsEditable(), @DomName('Node.parentNode'), read-only, inherited

The parent node of this node.

previousNodeNode
@DocsEditable(), @DomName('Node.previousSibling'), read-only, inherited

The previous sibling node.

runtimeTypeType
read-only, inherited

A representation of the runtime type of the object.

textString
@DocsEditable(), @DomName('Node.textContent'), read / write, inherited

All text within this node and its descendents.

treeRootNode
@DocsEditable(), @DomName('Node.treeRoot'), @Experimental(), read-only, inherited

Operators

operator ==(other) → bool
inherited

The equality operator.

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
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>
@DocsEditable(), @DomName('Document.getElementsByClassName')
getElementsByName(String elementName) → List<Node>
@DocsEditable(), @DomName('Document.getElementsByName')
getElementsByTagName(String localName) → List<Node>
@DocsEditable(), @DomName('Document.getElementsByTagName')
importNode(Node node, [ bool deep ]) → Node
query(String relativeSelectors) → Element
@DomName('Document.querySelector'), @Experimental()

Alias for querySelector. Note this function is deprecated because its semantics will be changing in the future.

queryAll(String relativeSelectors) → ElementList<Element>
@DomName('Document.querySelectorAll'), @Experimental()

Alias for querySelectorAll. Note this function is deprecated because its semantics will be changing in the future.

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
@DocsEditable(), @DomName('Document.querySelector')

Finds the first descendant element of this document that matches the specified group of selectors.

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
@DocsEditable(), @DomName('Node.appendChild'), inherited

Adds a node to the end of the child nodes list of this node.

clone(bool deep) → Node
@DocsEditable(), @DomName('Node.cloneNode'), inherited

Returns a copy of this node.

contains(Node other) → bool
@DocsEditable(), @DomName('Node.contains'), inherited

Returns true if this node contains the specified node.

dispatchEvent(Event event) → bool
@DocsEditable(), @DomName('EventTarget.dispatchEvent'), inherited
hasChildNodes() → bool
@DocsEditable(), @DomName('Node.hasChildNodes'), inherited

Returns true if this node has any children.

insertAllBefore(Iterable<Node> newNodes, Node refChild) → Node
inherited

Inserts all of the nodes into this node directly before refChild.

insertBefore(Node node, Node child) → Node
@DocsEditable(), @DomName('Node.insertBefore'), inherited

Inserts all of the nodes into this node directly before refChild.

noSuchMethod(Invocation invocation) → dynamic
inherited

Invoked when a non-existent method or property is accessed.

remove() → void
@DomName('Node.removeChild'), inherited

Removes this node from the DOM.

removeEventListener(String type, EventListener listener, [ bool useCapture ]) → void
inherited
replaceWith(Node otherNode) → Node
@DomName('Node.replaceChild'), inherited

Replaces this node with another node.

toString() → String
inherited

Print out a String representation of this Node.

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/1.24.3/dart-html/Document-class.html