Skip to content

Document ​

class Document extends Node

Annotations: @Native.new("Document")

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

Constructors ​

Document() factory ​

factory Document()
Implementation
dart
factory Document() {
  return Document._create_1();
}

Properties ​

activeElement no setter ​

Element? get activeElement
Implementation
dart
Element? get activeElement native;

addressSpace no setter ​

String? get addressSpace
Implementation
dart
String? get addressSpace native;

baseUri no setter inherited ​

String? get baseUri

Inherited from Node.

Implementation
dart
@JSName('baseURI')
String? get baseUri native;

childNodes no setter inherited ​

List<Node> get childNodes

A list of this node's children.

Other resources ​

Inherited from Node.

Implementation
dart
@Returns('NodeList')
@Creates('NodeList')
List<Node> get childNodes native;

contentType no setter ​

String? get contentType
Implementation
dart
String? get contentType native;
String? get cookie
Implementation
dart
String? get cookie native;

set cookie(String? value) native;

currentScript no setter ​

ScriptElement? get currentScript
Implementation
dart
ScriptElement? get currentScript native;

documentElement no setter ​

Element? get documentElement
Implementation
dart
Element? get documentElement native;

domain no setter ​

String? get domain
Implementation
dart
String? get domain native;

firstChild no setter inherited ​

Node? get firstChild

The first child of this node.

Other resources ​

Inherited from Node.

Implementation
dart
Node? get firstChild native;

fonts no setter ​

FontFaceSet? get fonts
Implementation
dart
FontFaceSet? get fonts native;

fullscreenElement no setter ​

Element? get fullscreenElement
Implementation
dart
Element? get fullscreenElement native;

fullscreenEnabled no setter ​

bool? get fullscreenEnabled
Implementation
dart
bool? get fullscreenEnabled native;

hashCode no setter inherited ​

int get hashCode

Inherited from Interceptor.

Implementation
dart
int get hashCode => Primitives.objectHashCode(this);

hidden no setter ​

bool? get hidden
Implementation
dart
bool? get hidden native;

implementation no setter ​

DomImplementation? get implementation
Implementation
dart
DomImplementation? get implementation native;

isConnected no setter inherited ​

bool? get isConnected

Inherited from Node.

Implementation
dart
bool? get isConnected native;

lastChild no setter inherited ​

Node? get lastChild

The last child of this node.

Other resources ​

Inherited from Node.

Implementation
dart
Node? get lastChild native;

nextNode no setter inherited ​

Node? get nextNode

The next sibling node.

Other resources ​

Inherited from Node.

Implementation
dart
@JSName('nextSibling')
&#47;**
 * The next sibling node.
 *
 * ## Other resources
 *
 * * [Node.nextSibling](https:&#47;&#47;developer.mozilla.org&#47;en-US&#47;docs&#47;Web&#47;API&#47;Node.nextSibling)
 *   from MDN.
 *&#47;
Node? get nextNode native;

nodeName no setter inherited ​

String? get nodeName

The name of this node.

This varies by this node's nodeType.

Other resources ​

Inherited from Node.

Implementation
dart
String? get nodeName native;

nodes read / write inherited ​

List<Node> get nodes

A modifiable list of this node's children.

Inherited from Node.

Implementation
dart
List<Node> get nodes {
  return new _ChildNodeListLazy(this);
}

set nodes(Iterable<Node> value) {
  &#47;&#47; Copy list first since we don't want liveness during iteration.
  &#47;&#47; TODO(jacobr): there is a better way to do this.
  var copy = value.toList();
  text = '';
  for (Node node in copy) {
    append(node);
  }
}

nodeType no setter inherited ​

int get nodeType

The type of node.

This value is one of:

Other resources ​

Inherited from Node.

Implementation
dart
int get nodeType native;

nodeValue no setter inherited ​

String? get nodeValue

The value of this node.

This varies by this type's nodeType.

Other resources ​

Inherited from Node.

Implementation
dart
String? get nodeValue native;

on no setter inherited ​

Events get on

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

Inherited from EventTarget.

Implementation
dart
Events get on => new Events(this);

onAbort no setter ​

Stream<Event> get onAbort

Stream of abort events handled by this Document.

Implementation
dart
Stream<Event> get onAbort => Element.abortEvent.forTarget(this);

onBeforeCopy no setter ​

Stream<Event> get onBeforeCopy

Stream of beforecopy events handled by this Document.

Implementation
dart
Stream<Event> get onBeforeCopy => Element.beforeCopyEvent.forTarget(this);

onBeforeCut no setter ​

Stream<Event> get onBeforeCut

Stream of beforecut events handled by this Document.

Implementation
dart
Stream<Event> get onBeforeCut => Element.beforeCutEvent.forTarget(this);

onBeforePaste no setter ​

Stream<Event> get onBeforePaste

Stream of beforepaste events handled by this Document.

Implementation
dart
Stream<Event> get onBeforePaste => Element.beforePasteEvent.forTarget(this);

onBlur no setter ​

Stream<Event> get onBlur

Stream of blur events handled by this Document.

Implementation
dart
Stream<Event> get onBlur => Element.blurEvent.forTarget(this);

onCanPlay no setter ​

Stream<Event> get onCanPlay
Implementation
dart
Stream<Event> get onCanPlay => Element.canPlayEvent.forTarget(this);

onCanPlayThrough no setter ​

Stream<Event> get onCanPlayThrough
Implementation
dart
Stream<Event> get onCanPlayThrough =>
    Element.canPlayThroughEvent.forTarget(this);

onChange no setter ​

Stream<Event> get onChange

Stream of change events handled by this Document.

Implementation
dart
Stream<Event> get onChange => Element.changeEvent.forTarget(this);

onClick no setter ​

Stream<MouseEvent> get onClick

Stream of click events handled by this Document.

Implementation
dart
Stream<MouseEvent> get onClick => Element.clickEvent.forTarget(this);

onContextMenu no setter ​

Stream<MouseEvent> get onContextMenu

Stream of contextmenu events handled by this Document.

Implementation
dart
Stream<MouseEvent> get onContextMenu =>
    Element.contextMenuEvent.forTarget(this);

onCopy no setter ​

Stream of copy events handled by this Document.

Implementation
dart
Stream<ClipboardEvent> get onCopy => Element.copyEvent.forTarget(this);

onCut no setter ​

Stream of cut events handled by this Document.

Implementation
dart
Stream<ClipboardEvent> get onCut => Element.cutEvent.forTarget(this);

onDoubleClick no setter ​

Stream<Event> get onDoubleClick

Stream of doubleclick events handled by this Document.

Implementation
dart
@DomName('Document.ondblclick')
Stream<Event> get onDoubleClick => Element.doubleClickEvent.forTarget(this);

onDrag no setter ​

Stream<MouseEvent> get onDrag

Stream of drag events handled by this Document.

Implementation
dart
Stream<MouseEvent> get onDrag => Element.dragEvent.forTarget(this);

onDragEnd no setter ​

Stream<MouseEvent> get onDragEnd

Stream of dragend events handled by this Document.

Implementation
dart
Stream<MouseEvent> get onDragEnd => Element.dragEndEvent.forTarget(this);

onDragEnter no setter ​

Stream<MouseEvent> get onDragEnter

Stream of dragenter events handled by this Document.

Implementation
dart
Stream<MouseEvent> get onDragEnter => Element.dragEnterEvent.forTarget(this);

onDragLeave no setter ​

Stream<MouseEvent> get onDragLeave

Stream of dragleave events handled by this Document.

Implementation
dart
Stream<MouseEvent> get onDragLeave => Element.dragLeaveEvent.forTarget(this);

onDragOver no setter ​

Stream<MouseEvent> get onDragOver

Stream of dragover events handled by this Document.

Implementation
dart
Stream<MouseEvent> get onDragOver => Element.dragOverEvent.forTarget(this);

onDragStart no setter ​

Stream<MouseEvent> get onDragStart

Stream of dragstart events handled by this Document.

Implementation
dart
Stream<MouseEvent> get onDragStart => Element.dragStartEvent.forTarget(this);

onDrop no setter ​

Stream<MouseEvent> get onDrop

Stream of drop events handled by this Document.

Implementation
dart
Stream<MouseEvent> get onDrop => Element.dropEvent.forTarget(this);

onDurationChange no setter ​

Stream<Event> get onDurationChange
Implementation
dart
Stream<Event> get onDurationChange =>
    Element.durationChangeEvent.forTarget(this);

onEmptied no setter ​

Stream<Event> get onEmptied
Implementation
dart
Stream<Event> get onEmptied => Element.emptiedEvent.forTarget(this);

onEnded no setter ​

Stream<Event> get onEnded
Implementation
dart
Stream<Event> get onEnded => Element.endedEvent.forTarget(this);

onError no setter ​

Stream<Event> get onError

Stream of error events handled by this Document.

Implementation
dart
Stream<Event> get onError => Element.errorEvent.forTarget(this);

onFocus no setter ​

Stream<Event> get onFocus

Stream of focus events handled by this Document.

Implementation
dart
Stream<Event> get onFocus => Element.focusEvent.forTarget(this);

onFullscreenChange no setter ​

Stream<Event> get onFullscreenChange

Stream of fullscreenchange events handled by this Document.

Implementation
dart
Stream<Event> get onFullscreenChange =>
    Element.fullscreenChangeEvent.forTarget(this);

onFullscreenError no setter ​

Stream<Event> get onFullscreenError

Stream of fullscreenerror events handled by this Document.

Implementation
dart
Stream<Event> get onFullscreenError =>
    Element.fullscreenErrorEvent.forTarget(this);

onInput no setter ​

Stream<Event> get onInput

Stream of input events handled by this Document.

Implementation
dart
Stream<Event> get onInput => Element.inputEvent.forTarget(this);

onInvalid no setter ​

Stream<Event> get onInvalid

Stream of invalid events handled by this Document.

Implementation
dart
Stream<Event> get onInvalid => Element.invalidEvent.forTarget(this);

onKeyDown no setter ​

Stream<KeyboardEvent> get onKeyDown

Stream of keydown events handled by this Document.

Implementation
dart
Stream<KeyboardEvent> get onKeyDown => Element.keyDownEvent.forTarget(this);

onKeyPress no setter ​

Stream<KeyboardEvent> get onKeyPress

Stream of keypress events handled by this Document.

Implementation
dart
Stream<KeyboardEvent> get onKeyPress => Element.keyPressEvent.forTarget(this);

onKeyUp no setter ​

Stream<KeyboardEvent> get onKeyUp

Stream of keyup events handled by this Document.

Implementation
dart
Stream<KeyboardEvent> get onKeyUp => Element.keyUpEvent.forTarget(this);

onLoad no setter ​

Stream<Event> get onLoad

Stream of load events handled by this Document.

Implementation
dart
Stream<Event> get onLoad => Element.loadEvent.forTarget(this);

onLoadedData no setter ​

Stream<Event> get onLoadedData
Implementation
dart
Stream<Event> get onLoadedData => Element.loadedDataEvent.forTarget(this);

onLoadedMetadata no setter ​

Stream<Event> get onLoadedMetadata
Implementation
dart
Stream<Event> get onLoadedMetadata =>
    Element.loadedMetadataEvent.forTarget(this);

onMouseDown no setter ​

Stream<MouseEvent> get onMouseDown

Stream of mousedown events handled by this Document.

Implementation
dart
Stream<MouseEvent> get onMouseDown => Element.mouseDownEvent.forTarget(this);

onMouseEnter no setter ​

Stream<MouseEvent> get onMouseEnter

Stream of mouseenter events handled by this Document.

Implementation
dart
Stream<MouseEvent> get onMouseEnter =>
    Element.mouseEnterEvent.forTarget(this);

onMouseLeave no setter ​

Stream<MouseEvent> get onMouseLeave

Stream of mouseleave events handled by this Document.

Implementation
dart
Stream<MouseEvent> get onMouseLeave =>
    Element.mouseLeaveEvent.forTarget(this);

onMouseMove no setter ​

Stream<MouseEvent> get onMouseMove

Stream of mousemove events handled by this Document.

Implementation
dart
Stream<MouseEvent> get onMouseMove => Element.mouseMoveEvent.forTarget(this);

onMouseOut no setter ​

Stream<MouseEvent> get onMouseOut

Stream of mouseout events handled by this Document.

Implementation
dart
Stream<MouseEvent> get onMouseOut => Element.mouseOutEvent.forTarget(this);

onMouseOver no setter ​

Stream<MouseEvent> get onMouseOver

Stream of mouseover events handled by this Document.

Implementation
dart
Stream<MouseEvent> get onMouseOver => Element.mouseOverEvent.forTarget(this);

onMouseUp no setter ​

Stream<MouseEvent> get onMouseUp

Stream of mouseup events handled by this Document.

Implementation
dart
Stream<MouseEvent> get onMouseUp => Element.mouseUpEvent.forTarget(this);

onMouseWheel no setter ​

Stream<WheelEvent> get onMouseWheel

Stream of mousewheel events handled by this Document.

Implementation
dart
Stream<WheelEvent> get onMouseWheel =>
    Element.mouseWheelEvent.forTarget(this);

onPaste no setter ​

Stream<ClipboardEvent> get onPaste

Stream of paste events handled by this Document.

Implementation
dart
Stream<ClipboardEvent> get onPaste => Element.pasteEvent.forTarget(this);

onPause no setter ​

Stream<Event> get onPause
Implementation
dart
Stream<Event> get onPause => Element.pauseEvent.forTarget(this);

onPlay no setter ​

Stream<Event> get onPlay
Implementation
dart
Stream<Event> get onPlay => Element.playEvent.forTarget(this);

onPlaying no setter ​

Stream<Event> get onPlaying
Implementation
dart
Stream<Event> get onPlaying => Element.playingEvent.forTarget(this);

onPointerLockChange no setter ​

Stream<Event> get onPointerLockChange
Implementation
dart
Stream<Event> get onPointerLockChange =>
    pointerLockChangeEvent.forTarget(this);

onPointerLockError no setter ​

Stream<Event> get onPointerLockError
Implementation
dart
Stream<Event> get onPointerLockError => pointerLockErrorEvent.forTarget(this);

onRateChange no setter ​

Stream<Event> get onRateChange
Implementation
dart
Stream<Event> get onRateChange => Element.rateChangeEvent.forTarget(this);

onReadyStateChange no setter ​

Stream<Event> get onReadyStateChange

Stream of readystatechange events handled by this Document.

Implementation
dart
Stream<Event> get onReadyStateChange => readyStateChangeEvent.forTarget(this);

onReset no setter ​

Stream<Event> get onReset

Stream of reset events handled by this Document.

Implementation
dart
Stream<Event> get onReset => Element.resetEvent.forTarget(this);

onResize no setter ​

Stream<Event> get onResize
Implementation
dart
Stream<Event> get onResize => Element.resizeEvent.forTarget(this);

onScroll no setter ​

Stream<Event> get onScroll

Stream of scroll events handled by this Document.

Implementation
dart
Stream<Event> get onScroll => Element.scrollEvent.forTarget(this);

onSearch no setter ​

Stream<Event> get onSearch

Stream of search events handled by this Document.

Implementation
dart
Stream<Event> get onSearch => Element.searchEvent.forTarget(this);

onSecurityPolicyViolation no setter ​

Stream<SecurityPolicyViolationEvent> get onSecurityPolicyViolation

Stream of securitypolicyviolation events handled by this Document.

Implementation
dart
Stream<SecurityPolicyViolationEvent> get onSecurityPolicyViolation =>
    securityPolicyViolationEvent.forTarget(this);

onSeeked no setter ​

Stream<Event> get onSeeked
Implementation
dart
Stream<Event> get onSeeked => Element.seekedEvent.forTarget(this);

onSeeking no setter ​

Stream<Event> get onSeeking
Implementation
dart
Stream<Event> get onSeeking => Element.seekingEvent.forTarget(this);

onSelect no setter ​

Stream<Event> get onSelect

Stream of select events handled by this Document.

Implementation
dart
Stream<Event> get onSelect => Element.selectEvent.forTarget(this);

onSelectionChange no setter ​

Stream<Event> get onSelectionChange

Stream of selectionchange events handled by this Document.

Implementation
dart
Stream<Event> get onSelectionChange => selectionChangeEvent.forTarget(this);

onSelectStart no setter ​

Stream<Event> get onSelectStart

Stream of selectstart events handled by this Document.

Implementation
dart
Stream<Event> get onSelectStart => Element.selectStartEvent.forTarget(this);

onStalled no setter ​

Stream<Event> get onStalled
Implementation
dart
Stream<Event> get onStalled => Element.stalledEvent.forTarget(this);

onSubmit no setter ​

Stream<Event> get onSubmit

Stream of submit events handled by this Document.

Implementation
dart
Stream<Event> get onSubmit => Element.submitEvent.forTarget(this);

onSuspend no setter ​

Stream<Event> get onSuspend
Implementation
dart
Stream<Event> get onSuspend => Element.suspendEvent.forTarget(this);

onTimeUpdate no setter ​

Stream<Event> get onTimeUpdate
Implementation
dart
Stream<Event> get onTimeUpdate => Element.timeUpdateEvent.forTarget(this);

onTouchCancel no setter ​

Stream<TouchEvent> get onTouchCancel

Stream of touchcancel events handled by this Document.

Implementation
dart
Stream<TouchEvent> get onTouchCancel =>
    Element.touchCancelEvent.forTarget(this);

onTouchEnd no setter ​

Stream<TouchEvent> get onTouchEnd

Stream of touchend events handled by this Document.

Implementation
dart
Stream<TouchEvent> get onTouchEnd => Element.touchEndEvent.forTarget(this);

onTouchMove no setter ​

Stream<TouchEvent> get onTouchMove

Stream of touchmove events handled by this Document.

Implementation
dart
Stream<TouchEvent> get onTouchMove => Element.touchMoveEvent.forTarget(this);

onTouchStart no setter ​

Stream<TouchEvent> get onTouchStart

Stream of touchstart events handled by this Document.

Implementation
dart
Stream<TouchEvent> get onTouchStart =>
    Element.touchStartEvent.forTarget(this);

onVolumeChange no setter ​

Stream<Event> get onVolumeChange
Implementation
dart
Stream<Event> get onVolumeChange => Element.volumeChangeEvent.forTarget(this);

onWaiting no setter ​

Stream<Event> get onWaiting
Implementation
dart
Stream<Event> get onWaiting => Element.waitingEvent.forTarget(this);

origin no setter ​

String? get origin
Implementation
dart
String? get origin native;

ownerDocument no setter inherited ​

Document? get ownerDocument

The document this node belongs to.

Returns null if this node does not belong to any document.

Other resources ​

Inherited from Node.

Implementation
dart
Document? get ownerDocument native;

parent no setter inherited ​

Element? get parent

The parent element of this node.

Returns null if this node either does not have a parent or its parent is not an element.

Other resources ​

Inherited from Node.

Implementation
dart
@JSName('parentElement')
&#47;**
 * The parent element of this node.
 *
 * Returns null if this node either does not have a parent or its parent is
 * not an element.
 *
 * ## Other resources
 *
 * * [Node.parentElement](https:&#47;&#47;developer.mozilla.org&#47;en-US&#47;docs&#47;Web&#47;API&#47;Node.parentElement)
 *   from W3C.
 *&#47;
Element? get parent native;

parentNode no setter inherited ​

Node? get parentNode

The parent node of this node.

Other resources ​

Inherited from Node.

Implementation
dart
Node? get parentNode native;

pointerLockElement no setter ​

Element? get pointerLockElement
Implementation
dart
Element? get pointerLockElement native;

previousNode no setter inherited ​

Node? get previousNode

The previous sibling node.

Other resources ​

Inherited from Node.

Implementation
dart
@JSName('previousSibling')
&#47;**
 * The previous sibling node.
 *
 * ## Other resources
 *
 * * [Node.previousSibling](https:&#47;&#47;developer.mozilla.org&#47;en-US&#47;docs&#47;Web&#47;API&#47;Node.previousSibling)
 *   from MDN.
 *&#47;
Node? get previousNode native;

readyState no setter ​

String? get readyState
Implementation
dart
String? get readyState native;

rootElement no setter ​

SvgSvgElement? get rootElement
Implementation
dart
SvgSvgElement? get rootElement native;

rootScroller read / write ​

Element? get rootScroller
Implementation
dart
Element? get rootScroller native;

set rootScroller(Element? value) native;

runtimeType no setter inherited ​

Type get runtimeType

Inherited from Interceptor.

Implementation
dart
Type get runtimeType =>
    getRuntimeTypeOfInterceptorNotArray(getInterceptor(this), this);

scrollingElement no setter ​

Element? get scrollingElement
Implementation
dart
Element? get scrollingElement native;

suborigin no setter ​

String? get suborigin
Implementation
dart
String? get suborigin native;

text read / write inherited ​

String? get text

All text within this node and its descendants.

Other resources ​

Inherited from Node.

Implementation
dart
@JSName('textContent')
&#47;**
 * All text within this node and its descendants.
 *
 * ## Other resources
 *
 * * [Node.textContent](https:&#47;&#47;developer.mozilla.org&#47;en-US&#47;docs&#47;Web&#47;API&#47;Node.textContent)
 *   from MDN.
 *&#47;
String? get text native;

@JSName('textContent')
set text(String? value) native;

timeline no setter ​

DocumentTimeline? get timeline
Implementation
dart
DocumentTimeline? get timeline native;

visibilityState no setter ​

String get visibilityState
Implementation
dart
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.FIREFOX)
@SupportedBrowser(SupportedBrowser.IE, '10')
String get visibilityState => JS(
  'String',
  '(#.visibilityState || #.mozVisibilityState || #.msVisibilityState ||'
      '#.webkitVisibilityState)',
  this,
  this,
  this,
  this,
);

window no setter ​

WindowBase? get window
Implementation
dart
WindowBase? get window => _convertNativeToDart_Window(this._get_window);

Methods ​

addEventListener() inherited ​

void addEventListener(
  String type,
  (dynamic Function(Event event))? listener, [
  bool? useCapture,
])

Inherited from EventTarget.

Implementation
dart
void addEventListener(
  String type,
  EventListener? listener, [
  bool? useCapture,
]) {
  &#47;&#47; TODO(leafp): This check is avoid a bug in our dispatch code when
  &#47;&#47; listener is null.  The browser treats this call as a no-op in this
  &#47;&#47; case, so it's fine to short-circuit it, but we should not have to.
  if (listener != null) {
    _addEventListener(type, listener, useCapture);
  }
}

adoptNode() ​

Node adoptNode(Node node)
Implementation
dart
Node adoptNode(Node node) native;

append() inherited ​

Node append(Node node)

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

If the node already exists in this document, it will be removed from its current parent node, then added to this node.

This method is more efficient than nodes.add, and is the preferred way of appending a child node.

Inherited from Node.

Implementation
dart
@JSName('appendChild')
&#47;**
 * Adds a node to the end of the child [nodes] list of this node.
 *
 * If the node already exists in this document, it will be removed from its
 * current parent node, then added to this node.
 *
 * This method is more efficient than `nodes.add`, and is the preferred
 * way of appending a child node.
 *&#47;
Node append(Node node) native;

clone() inherited ​

Node clone(bool? deep)

Returns a copy of this node.

If deep is true, then all of this node's children and descendants are copied as well. If deep is false, then only this node is copied.

Other resources ​

Inherited from Node.

Implementation
dart
@JSName('cloneNode')
&#47;**
 * Returns a copy of this node.
 *
 * If [deep] is `true`, then all of this node's children and descendants are
 * copied as well. If [deep] is `false`, then only this node is copied.
 *
 * ## Other resources
 *
 * * [Node.cloneNode](https:&#47;&#47;developer.mozilla.org&#47;en-US&#47;docs&#47;Web&#47;API&#47;Node.cloneNode)
 *   from MDN.
 *&#47;
Node clone(bool? deep) native;

contains() inherited ​

bool contains(Node? other)

Returns true if this node contains the specified node.

Other resources ​

Inherited from Node.

Implementation
dart
bool contains(Node? other) native;

createDocumentFragment() ​

DocumentFragment createDocumentFragment()
Implementation
dart
DocumentFragment createDocumentFragment() native;

createElement() ​

Element createElement(String tagName, [String? typeExtension])
Implementation
dart
@pragma('dart2js:tryInline') &#47;&#47; Almost all call sites have one argument.
Element createElement(String tagName, [String? typeExtension]) {
  return (typeExtension == null)
      ? _createElement_2(tagName)
      : _createElement(tagName, typeExtension);
}

createElementNS() ​

Element createElementNS(
  String namespaceURI,
  String qualifiedName, [
  String? typeExtension,
])
Implementation
dart
Element createElementNS(
  String namespaceURI,
  String qualifiedName, [
  String? typeExtension,
]) {
  return (typeExtension == null)
      ? _createElementNS_2(namespaceURI, qualifiedName)
      : _createElementNS(namespaceURI, qualifiedName, typeExtension);
}

createRange() ​

Range createRange()
Implementation
dart
Range createRange() native;

dispatchEvent() inherited ​

bool dispatchEvent(Event event)

Inherited from EventTarget.

Implementation
dart
bool dispatchEvent(Event event) native;

elementsFromPoint() ​

List<Element> elementsFromPoint(int x, int y)
Implementation
dart
List<Element> elementsFromPoint(int x, int y) native;

execCommand() ​

bool execCommand(String commandId, [bool? showUI, String? value])
Implementation
dart
bool execCommand(String commandId, [bool? showUI, String? value]) native;

exitFullscreen() ​

void exitFullscreen()
Implementation
dart
void exitFullscreen() native;

exitPointerLock() ​

void exitPointerLock()
Implementation
dart
void exitPointerLock() native;

getAnimations() ​

List<Animation> getAnimations()
Implementation
dart
List<Animation> getAnimations() native;

getElementById() ​

Element? getElementById(String elementId)
Implementation
dart
Element? getElementById(String elementId) native;

getElementsByClassName() ​

List<Node> getElementsByClassName(String classNames)
Implementation
dart
@Creates('NodeList|HtmlCollection')
@Returns('NodeList|HtmlCollection')
List<Node> getElementsByClassName(String classNames) native;

getElementsByName() ​

List<Node> getElementsByName(String elementName)
Implementation
dart
@Creates('NodeList|HtmlCollection')
@Returns('NodeList|HtmlCollection')
List<Node> getElementsByName(String elementName) native;

getElementsByTagName() ​

List<Node> getElementsByTagName(String localName)
Implementation
dart
@Creates('NodeList|HtmlCollection')
@Returns('NodeList|HtmlCollection')
List<Node> getElementsByTagName(String localName) native;

getRootNode() inherited ​

Node getRootNode([Map<dynamic, dynamic>? options])

Inherited from Node.

Implementation
dart
Node getRootNode([Map? options]) {
  if (options != null) {
    var options_1 = convertDartToNative_Dictionary(options);
    return _getRootNode_1(options_1);
  }
  return _getRootNode_2();
}

hasChildNodes() inherited ​

bool hasChildNodes()

Returns true if this node has any children.

Other resources ​

Inherited from Node.

Implementation
dart
bool hasChildNodes() native;

importNode() ​

Node importNode(Node node, [bool? deep])
Implementation
dart
Node importNode(Node node, [bool? deep]) native;

insertAllBefore() inherited ​

void insertAllBefore(Iterable<Node> newNodes, Node child)

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

See also:

Inherited from Node.

Implementation
dart
void insertAllBefore(Iterable<Node> newNodes, Node child) {
  if (newNodes is _ChildNodeListLazy) {
    _ChildNodeListLazy otherList = newNodes;
    if (identical(otherList._this, this)) {
      throw new ArgumentError(newNodes);
    }

    &#47;&#47; Optimized route for copying between nodes.
    for (var i = 0, len = otherList.length; i < len; ++i) {
      this.insertBefore(otherList._this.firstChild!, child);
    }
  } else {
    for (var node in newNodes) {
      this.insertBefore(node, child);
    }
  }
}

insertBefore() inherited ​

Node insertBefore(Node node, Node? child)

Inserts the given node into this node directly before child. If child is null, then the given node is inserted at the end of this node's child nodes.

Other resources ​

Inherited from Node.

Implementation
dart
Node insertBefore(Node node, Node? child) native;

noSuchMethod() inherited ​

dynamic noSuchMethod(Invocation invocation)

Invoked when a nonexistent method or property is accessed.

A dynamic member invocation can attempt to call a member which doesn't exist on the receiving object. Example:

dart
dynamic object = 1;
object.add(42); // Statically allowed, run-time error

This invalid code will invoke the noSuchMethod method of the integer 1 with an Invocation representing the .add(42) call and arguments (which then throws).

Classes can override noSuchMethod to provide custom behavior for such invalid dynamic invocations.

A class with a non-default noSuchMethod invocation can also omit implementations for members of its interface. Example:

dart
class MockList<T> implements List<T> {
  noSuchMethod(Invocation invocation) {
    log(invocation);
    super.noSuchMethod(invocation); // Will throw.
  }
}
void main() {
  MockList().add(42);
}

This code has no compile-time warnings or errors even though the MockList class has no concrete implementation of any of the List interface methods. Calls to List methods are forwarded to noSuchMethod, so this code will log an invocation similar to Invocation.method(#add, [42]) and then throw.

If a value is returned from noSuchMethod, it becomes the result of the original invocation. If the value is not of a type that can be returned by the original invocation, a type error occurs at the invocation.

The default behavior is to throw a NoSuchMethodError.

Inherited from Interceptor.

Implementation
dart
dynamic noSuchMethod(Invocation invocation) {
  throw NoSuchMethodError.withInvocation(this, invocation);
}

queryCommandEnabled() ​

bool queryCommandEnabled(String commandId)
Implementation
dart
bool queryCommandEnabled(String commandId) native;

queryCommandIndeterm() ​

bool queryCommandIndeterm(String commandId)
Implementation
dart
bool queryCommandIndeterm(String commandId) native;

queryCommandState() ​

bool queryCommandState(String commandId)
Implementation
dart
bool queryCommandState(String commandId) native;

queryCommandSupported() ​

bool queryCommandSupported(String commandId)
Implementation
dart
bool queryCommandSupported(String commandId) native;

queryCommandValue() ​

String queryCommandValue(String commandId)
Implementation
dart
String queryCommandValue(String commandId) native;

querySelector() ​

Element? querySelector(String selectors)

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

Unless your webpage contains multiple documents, the top-level querySelector method behaves the same as this method, so you should use it instead to save typing a few characters.

selectors should be a string using CSS selector syntax.

dart
var element1 = document.querySelector('.className');
var element2 = document.querySelector('#id');

For details about CSS selector syntax, see the CSS selector specification.

Implementation
dart
Element? querySelector(String selectors) native;

querySelectorAll() ​

ElementList<T> querySelectorAll<T extends Element>(String selectors)

Finds all descendant elements of this document that match the specified group of selectors.

Unless your webpage contains multiple documents, the top-level querySelectorAll method behaves the same as this method, so you should use it instead to save typing a few characters.

selectors should be a string using CSS selector syntax.

dart
var items = document.querySelectorAll('.itemClassName');

For details about CSS selector syntax, see the CSS selector specification.

Implementation
dart
ElementList<T> querySelectorAll<T extends Element>(String selectors) =>
    new _FrozenElementList<T>._wrap(_querySelectorAll(selectors));

remove() inherited ​

void remove()

Removes this node from the DOM.

Inherited from Node.

Implementation
dart
void remove() {
  &#47;&#47; TODO(jacobr): should we throw an exception if parent is already null?
  &#47;&#47; TODO(vsm): Use the native remove when available.
  if (this.parentNode != null) {
    final Node parent = this.parentNode!;
    parent._removeChild(this);
  }
}

removeEventListener() inherited ​

void removeEventListener(
  String type,
  (dynamic Function(Event event))? listener, [
  bool? useCapture,
])

Inherited from EventTarget.

Implementation
dart
void removeEventListener(
  String type,
  EventListener? listener, [
  bool? useCapture,
]) {
  &#47;&#47; TODO(leafp): This check is avoid a bug in our dispatch code when
  &#47;&#47; listener is null.  The browser treats this call as a no-op in this
  &#47;&#47; case, so it's fine to short-circuit it, but we should not have to.
  if (listener != null) {
    _removeEventListener(type, listener, useCapture);
  }
}

replaceWith() inherited ​

Node replaceWith(Node otherNode)

Replaces this node with another node.

Inherited from Node.

Implementation
dart
Node replaceWith(Node otherNode) {
  try {
    final Node parent = this.parentNode!;
    parent._replaceChild(otherNode, this);
  } catch (e) {}
  return this;
}

toString() inherited ​

String toString()

Print out a String representation of this Node.

Inherited from Node.

Implementation
dart
String toString() {
  String? value = nodeValue; &#47;&#47; Fetch DOM Node property once.
  return value == null ? super.toString() : value;
}

Operators ​

operator ==() inherited ​

bool operator ==(Object other)

The equality operator.

The default behavior for all Objects is to return true if and only if this object and other are the same object.

Override this method to specify a different equality relation on a class. The overriding method must still be an equivalence relation. That is, it must be:

  • Total: It must return a boolean for all arguments. It should never throw.

  • Reflexive: For all objects o, o == o must be true.

  • Symmetric: For all objects o1 and o2, o1 == o2 and o2 == o1 must either both be true, or both be false.

  • Transitive: For all objects o1, o2, and o3, if o1 == o2 and o2 == o3 are true, then o1 == o3 must be true.

The method should also be consistent over time, so whether two objects are equal should only change if at least one of the objects was modified.

If a subclass overrides the equality operator, it should override the hashCode method as well to maintain consistency.

Inherited from Interceptor.

Implementation
dart
bool operator ==(Object other) => identical(this, other);

Constants ​

pointerLockChangeEvent ​

const EventStreamProvider<Event> pointerLockChangeEvent
Implementation
dart
static const EventStreamProvider<Event> pointerLockChangeEvent =
    const EventStreamProvider<Event>('pointerlockchange');

pointerLockErrorEvent ​

const EventStreamProvider<Event> pointerLockErrorEvent
Implementation
dart
static const EventStreamProvider<Event> pointerLockErrorEvent =
    const EventStreamProvider<Event>('pointerlockerror');

readyStateChangeEvent ​

const EventStreamProvider<Event> readyStateChangeEvent

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

See EventStreamProvider for usage information.

Implementation
dart
static const EventStreamProvider<Event> readyStateChangeEvent =
    const EventStreamProvider<Event>('readystatechange');

securityPolicyViolationEvent ​

const EventStreamProvider<SecurityPolicyViolationEvent> securityPolicyViolationEvent

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

See EventStreamProvider for usage information.

Implementation
dart
static const EventStreamProvider<SecurityPolicyViolationEvent>
securityPolicyViolationEvent =
    const EventStreamProvider<SecurityPolicyViolationEvent>(
      'securitypolicyviolation',
    );

selectionChangeEvent ​

const EventStreamProvider<Event> selectionChangeEvent

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

See EventStreamProvider for usage information.

Implementation
dart
static const EventStreamProvider<Event> selectionChangeEvent =
    const EventStreamProvider<Event>('selectionchange');