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
- JSObject
- DartHtmlDomObject
- EventTarget
- Node
- Document
- Implemented by
- Annotations
- @DocsEditable()
- @DomName('Document')
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> @DocsEditable(), @DomName('Document.readystatechangeEvent')
-
Static factory designed to expose
readystatechangeevents to event handlers that are not necessarily instances of Document.const EventStreamProvider<Event>('readystatechange') - securityPolicyViolationEvent → EventStreamProvider<SecurityPolicyViolationEvent> @DocsEditable(), @DomName('Document.securitypolicyviolationEvent'), @Experimental()
-
Static factory designed to expose
securitypolicyviolationevents to event handlers that are not necessarily instances of Document. - selectionChangeEvent → EventStreamProvider<Event> @DocsEditable(), @DomName('Document.selectionchangeEvent')
-
Static factory designed to expose
selectionchangeevents to event handlers that are not necessarily instances of Document.const EventStreamProvider<Event>('selectionchange')
Static Properties
- instanceRuntimeType → Type @Deprecated("Internal Use Only"), read-only
Constructors
Properties
- activeElement → Element @DocsEditable(), @DomName('Document.activeElement'), @Experimental(), read-only
- contentType → String @DocsEditable(), @DomName('Document.contentType'), @Experimental(), read-only
- currentScript → ScriptElement @DocsEditable(), @DomName('Document.currentScript'), @Experimental(), read-only
- documentElement → Element @DocsEditable(), @DomName('Document.documentElement'), read-only
- domain → String @DocsEditable(), @DomName('Document.domain'), read-only
- fonts → FontFaceSet @DocsEditable(), @DomName('Document.fonts'), @Experimental(), read-only
- fullscreenElement → Element @DocsEditable(), @DomName('Document.fullscreenElement'), @Experimental(), read-only
- fullscreenEnabled → bool @DocsEditable(), @DomName('Document.fullscreenEnabled'), @Experimental(), read-only
- implementation → DomImplementation @DocsEditable(), @DomName('Document.implementation'), read-only
- onAbort → Stream<Event> @DocsEditable(), @DomName('Document.onabort'), read-only
-
Stream of
abortevents handled by thisDocument. - onBeforeCopy → Stream<Event> @DocsEditable(), @DomName('Document.onbeforecopy'), read-only
-
Stream of
beforecopyevents handled by thisDocument. - onBeforeCut → Stream<Event> @DocsEditable(), @DomName('Document.onbeforecut'), read-only
-
Stream of
beforecutevents handled by thisDocument. - onBeforePaste → Stream<Event> @DocsEditable(), @DomName('Document.onbeforepaste'), read-only
-
Stream of
beforepasteevents handled by thisDocument. - onBlur → Stream<Event> @DocsEditable(), @DomName('Document.onblur'), read-only
-
Stream of
blurevents handled by thisDocument. - onCanPlay → Stream<Event> @DocsEditable(), @DomName('Document.oncanplay'), @Experimental(), read-only
- onCanPlayThrough → Stream<Event> @DocsEditable(), @DomName('Document.oncanplaythrough'), @Experimental(), read-only
- onChange → Stream<Event> @DocsEditable(), @DomName('Document.onchange'), read-only
-
Stream of
changeevents handled by thisDocument. - onClick → Stream<MouseEvent> @DocsEditable(), @DomName('Document.onclick'), read-only
-
Stream of
clickevents handled by thisDocument. - onContextMenu → Stream<MouseEvent> @DocsEditable(), @DomName('Document.oncontextmenu'), read-only
-
Stream of
contextmenuevents handled by thisDocument. - onCopy → Stream<ClipboardEvent> @DocsEditable(), @DomName('Document.oncopy'), read-only
-
Stream of
copyevents handled by thisDocument. - onCut → Stream<ClipboardEvent> @DocsEditable(), @DomName('Document.oncut'), read-only
-
Stream of
cutevents handled by thisDocument. - onDoubleClick → Stream<Event> @DocsEditable(), @DomName('Document.ondblclick'), read-only
-
Stream of
doubleclickevents handled by thisDocument. - onDrag → Stream<MouseEvent> @DocsEditable(), @DomName('Document.ondrag'), read-only
-
Stream of
dragevents handled by thisDocument. - onDragEnd → Stream<MouseEvent> @DocsEditable(), @DomName('Document.ondragend'), read-only
-
Stream of
dragendevents handled by thisDocument. - onDragEnter → Stream<MouseEvent> @DocsEditable(), @DomName('Document.ondragenter'), read-only
-
Stream of
dragenterevents handled by thisDocument. - onDragLeave → Stream<MouseEvent> @DocsEditable(), @DomName('Document.ondragleave'), read-only
-
Stream of
dragleaveevents handled by thisDocument. - onDragOver → Stream<MouseEvent> @DocsEditable(), @DomName('Document.ondragover'), read-only
-
Stream of
dragoverevents handled by thisDocument. - onDragStart → Stream<MouseEvent> @DocsEditable(), @DomName('Document.ondragstart'), read-only
-
Stream of
dragstartevents handled by thisDocument. - onDrop → Stream<MouseEvent> @DocsEditable(), @DomName('Document.ondrop'), read-only
-
Stream of
dropevents handled by thisDocument. - 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> @DocsEditable(), @DomName('Document.onerror'), read-only
-
Stream of
errorevents handled by thisDocument. - onFocus → Stream<Event> @DocsEditable(), @DomName('Document.onfocus'), read-only
-
Stream of
focusevents handled by thisDocument. - onFullscreenChange → Stream<Event> @DocsEditable(), @DomName('Document.onwebkitfullscreenchange'), @Experimental(), read-only
-
Stream of
fullscreenchangeevents handled by thisDocument. - onFullscreenError → Stream<Event> @DocsEditable(), @DomName('Document.onwebkitfullscreenerror'), @Experimental(), read-only
-
Stream of
fullscreenerrorevents handled by thisDocument. - onInput → Stream<Event> @DocsEditable(), @DomName('Document.oninput'), read-only
-
Stream of
inputevents handled by thisDocument. - onInvalid → Stream<Event> @DocsEditable(), @DomName('Document.oninvalid'), read-only
-
Stream of
invalidevents handled by thisDocument. - onKeyDown → Stream<KeyboardEvent> @DocsEditable(), @DomName('Document.onkeydown'), read-only
-
Stream of
keydownevents handled by thisDocument. - onKeyPress → Stream<KeyboardEvent> @DocsEditable(), @DomName('Document.onkeypress'), read-only
-
Stream of
keypressevents handled by thisDocument. - onKeyUp → Stream<KeyboardEvent> @DocsEditable(), @DomName('Document.onkeyup'), read-only
-
Stream of
keyupevents handled by thisDocument. - onLoad → Stream<Event> @DocsEditable(), @DomName('Document.onload'), read-only
-
Stream of
loadevents handled by thisDocument. - onLoadedData → Stream<Event> @DocsEditable(), @DomName('Document.onloadeddata'), @Experimental(), read-only
- onLoadedMetadata → Stream<Event> @DocsEditable(), @DomName('Document.onloadedmetadata'), @Experimental(), read-only
- onMouseDown → Stream<MouseEvent> @DocsEditable(), @DomName('Document.onmousedown'), read-only
-
Stream of
mousedownevents handled by thisDocument. - onMouseEnter → Stream<MouseEvent> @DocsEditable(), @DomName('Document.onmouseenter'), @Experimental(), read-only
-
Stream of
mouseenterevents handled by thisDocument. - onMouseLeave → Stream<MouseEvent> @DocsEditable(), @DomName('Document.onmouseleave'), @Experimental(), read-only
-
Stream of
mouseleaveevents handled by thisDocument. - onMouseMove → Stream<MouseEvent> @DocsEditable(), @DomName('Document.onmousemove'), read-only
-
Stream of
mousemoveevents handled by thisDocument. - onMouseOut → Stream<MouseEvent> @DocsEditable(), @DomName('Document.onmouseout'), read-only
-
Stream of
mouseoutevents handled by thisDocument. - onMouseOver → Stream<MouseEvent> @DocsEditable(), @DomName('Document.onmouseover'), read-only
-
Stream of
mouseoverevents handled by thisDocument. - onMouseUp → Stream<MouseEvent> @DocsEditable(), @DomName('Document.onmouseup'), read-only
-
Stream of
mouseupevents handled by thisDocument. - onMouseWheel → Stream<WheelEvent> @DocsEditable(), @DomName('Document.onmousewheel'), read-only
-
Stream of
mousewheelevents handled by thisDocument. - onPaste → Stream<ClipboardEvent> @DocsEditable(), @DomName('Document.onpaste'), read-only
-
Stream of
pasteevents handled by thisDocument. - 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> @DocsEditable(), @DomName('Document.onreadystatechange'), read-only
-
Stream of
readystatechangeevents handled by thisDocument. - onReset → Stream<Event> @DocsEditable(), @DomName('Document.onreset'), read-only
-
Stream of
resetevents handled by thisDocument. - onResize → Stream<Event> @DocsEditable(), @DomName('Document.onresize'), @Experimental(), read-only
- onScroll → Stream<Event> @DocsEditable(), @DomName('Document.onscroll'), read-only
-
Stream of
scrollevents handled by thisDocument. - onSearch → Stream<Event> @DocsEditable(), @DomName('Document.onsearch'), @Experimental(), read-only
-
Stream of
searchevents handled by thisDocument. - onSecurityPolicyViolation → Stream<SecurityPolicyViolationEvent> @DocsEditable(), @DomName('Document.onsecuritypolicyviolation'), @Experimental(), read-only
-
Stream of
securitypolicyviolationevents handled by thisDocument. - onSeeked → Stream<Event> @DocsEditable(), @DomName('Document.onseeked'), @Experimental(), read-only
- onSeeking → Stream<Event> @DocsEditable(), @DomName('Document.onseeking'), @Experimental(), read-only
- onSelect → Stream<Event> @DocsEditable(), @DomName('Document.onselect'), read-only
-
Stream of
selectevents handled by thisDocument. - onSelectionChange → Stream<Event> @DocsEditable(), @DomName('Document.onselectionchange'), read-only
-
Stream of
selectionchangeevents handled by thisDocument. - onSelectStart → Stream<Event> @DocsEditable(), @DomName('Document.onselectstart'), read-only
-
Stream of
selectstartevents handled by thisDocument. - onStalled → Stream<Event> @DocsEditable(), @DomName('Document.onstalled'), @Experimental(), read-only
- onSubmit → Stream<Event> @DocsEditable(), @DomName('Document.onsubmit'), read-only
-
Stream of
submitevents handled by thisDocument. - onSuspend → Stream<Event> @DocsEditable(), @DomName('Document.onsuspend'), @Experimental(), read-only
- onTimeUpdate → Stream<Event> @DocsEditable(), @DomName('Document.ontimeupdate'), @Experimental(), read-only
- onTouchCancel → Stream<TouchEvent> @DocsEditable(), @DomName('Document.ontouchcancel'), @Experimental(), read-only
-
Stream of
touchcancelevents handled by thisDocument. - onTouchEnd → Stream<TouchEvent> @DocsEditable(), @DomName('Document.ontouchend'), @Experimental(), read-only
-
Stream of
touchendevents handled by thisDocument. - onTouchMove → Stream<TouchEvent> @DocsEditable(), @DomName('Document.ontouchmove'), @Experimental(), read-only
-
Stream of
touchmoveevents handled by thisDocument. - onTouchStart → Stream<TouchEvent> @DocsEditable(), @DomName('Document.ontouchstart'), @Experimental(), read-only
-
Stream of
touchstartevents handled by thisDocument. - 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(), read-only
- pointerLockElement → Element @DocsEditable(), @DomName('Document.pointerLockElement'), @Experimental(), read-only
- readyState → String @DocsEditable(), @DomName('Document.readyState'), read-only
- rootElement → SvgSvgElement @DocsEditable(), @DomName('Document.rootElement'), @Experimental(), read-only
- scrollingElement → Element @DocsEditable(), @DomName('Document.scrollingElement'), @Experimental(), read-only
- suborigin → String @DocsEditable(), @DomName('Document.suborigin'), @Experimental(), read-only
- supportsRegister → bool @deprecated, read-only
-
Deprecated*: use
supportsRegisterElementinstead. - supportsRegisterElement → bool read-only
-
Checks if
registerElementis supported on the current platform. - timeline → AnimationTimeline @DocsEditable(), @DomName('Document.timeline'), @Experimental(), read-only
- visibilityState → String @DomName('Document.visibilityState'), @Experimental(), @SupportedBrowser(SupportedBrowser.CHROME), @SupportedBrowser(SupportedBrowser.FIREFOX), @SupportedBrowser(SupportedBrowser.IE, '10'), read-only
- window → WindowBase @DocsEditable(), @DomName('Document.defaultView'), read-only
- baseUri → String @DocsEditable(), @DomName('Node.baseURI'), read-only, inherited
- childNodes → List<Node> @DocsEditable(), @DomName('Node.childNodes'), read-only, inherited
-
A list of this node's children.
- firstChild → Node @DocsEditable(), @DomName('Node.firstChild'), read-only, inherited
-
The first child of this node.
- hashCode → int read-only, inherited
- lastChild → Node @DocsEditable(), @DomName('Node.lastChild'), read-only, inherited
-
The last child of this node.
- nextNode → Node @DocsEditable(), @DomName('Node.nextSibling'), read-only, inherited
-
The next sibling node.
- nodeName → String @DocsEditable(), @DomName('Node.nodeName'), read-only, inherited
-
The name of this node.
- nodes → List<Node> read / write, inherited
-
A modifiable list of this node's children.
- nodeType → int @DocsEditable(), @DomName('Node.nodeType'), read-only, inherited
-
The type of node.
- nodeValue → String @DocsEditable(), @DomName('Node.nodeValue'), read-only, inherited
-
The value of this node.
- on → Events 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.
- ownerDocument → Document @DocsEditable(), @DomName('Node.ownerDocument'), read-only, inherited
-
The document this node belongs to.
- parent → Element @DocsEditable(), @DomName('Node.parentElement'), read-only, inherited
-
The parent element of this node.
- parentNode → Node @DocsEditable(), @DomName('Node.parentNode'), read-only, inherited
-
The parent node of this node.
- previousNode → Node @DocsEditable(), @DomName('Node.previousSibling'), read-only, inherited
-
The previous sibling node.
- runtimeType → Type read-only, inherited
-
A representation of the runtime type of the object.
- text → String @DocsEditable(), @DomName('Node.textContent'), read / write, inherited
-
All text within this node and its descendents.
- treeRoot → Node @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