Document#
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
Implementers
Constructors#
Document() factory#
Implementation
factory Document() {
return Document._create_1();
}
Properties#
activeElement no setter#
Implementation
Element? get activeElement native;
addressSpace no setter#
Implementation
String? get addressSpace native;
baseUri no setter inherited#
Inherited from Node.
Implementation
@JSName('baseURI')
String? get baseUri native;
childNodes no setter inherited#
A list of this node's children.
Other resources
- Node.childNodes from MDN.
Inherited from Node.
Implementation
@Returns('NodeList')
@Creates('NodeList')
List<Node> get childNodes native;
contentType no setter#
Implementation
String? get contentType native;
cookie read / write#
Implementation
String? get cookie native;
set cookie(String? value) native;
currentScript no setter#
Implementation
ScriptElement? get currentScript native;
documentElement no setter#
Implementation
Element? get documentElement native;
domain no setter#
Implementation
String? get domain native;
firstChild no setter inherited#
The first child of this node.
Other resources
- Node.firstChild from MDN.
Inherited from Node.
Implementation
Node? get firstChild native;
fonts no setter#
Implementation
FontFaceSet? get fonts native;
fullscreenElement no setter#
Implementation
Element? get fullscreenElement native;
fullscreenEnabled no setter#
Implementation
bool? get fullscreenEnabled native;
hashCode no setter inherited#
Inherited from Interceptor.
Implementation
int get hashCode => Primitives.objectHashCode(this);
hidden no setter#
Implementation
bool? get hidden native;
implementation no setter#
Implementation
DomImplementation? get implementation native;
isConnected no setter inherited#
Inherited from Node.
Implementation
bool? get isConnected native;
lastChild no setter inherited#
The last child of this node.
Other resources
- Node.lastChild from MDN.
Inherited from Node.
Implementation
Node? get lastChild native;
nextNode no setter inherited#
The next sibling node.
Other resources
- Node.nextSibling from MDN.
Inherited from Node.
Implementation
@JSName('nextSibling')
/**
* The next sibling node.
*
* ## Other resources
*
* * [Node.nextSibling](https://developer.mozilla.org/en-US/docs/Web/API/Node.nextSibling)
* from MDN.
*/
Node? get nextNode native;
nodeName no setter inherited#
The name of this node.
This varies by this node's nodeType.
Other resources
- Node.nodeName from MDN. This page contains a table of nodeName values for each nodeType.
Inherited from Node.
Implementation
String? get nodeName native;
nodes read / write inherited#
A modifiable list of this node's children.
Inherited from Node.
Implementation
List<Node> get nodes {
return new _ChildNodeListLazy(this);
}
set nodes(Iterable<Node> value) {
// Copy list first since we don't want liveness during iteration.
// 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#
The type of node.
This value is one of:
- ATTRIBUTE_NODE if this node is an attribute.
- CDATA_SECTION_NODE if this node is a CDataSection.
- COMMENT_NODE if this node is a Comment.
- DOCUMENT_FRAGMENT_NODE if this node is a DocumentFragment.
- DOCUMENT_NODE if this node is a Document.
-
DOCUMENT_TYPE_NODE
if this node is a
_DocumentTypenode. - ELEMENT_NODE if this node is an Element.
- ENTITY_NODE if this node is an entity.
- ENTITY_REFERENCE_NODE if this node is an entity reference.
- NOTATION_NODE if this node is a notation.
- PROCESSING_INSTRUCTION_NODE if this node is a ProcessingInstruction.
- TEXT_NODE if this node is a Text node.
Other resources
- Node.nodeType from MDN.
Inherited from Node.
Implementation
int get nodeType native;
nodeValue no setter inherited#
The value of this node.
This varies by this type's nodeType.
Other resources
- Node.nodeValue from MDN. This page contains a table of nodeValue values for each nodeType.
Inherited from Node.
Implementation
String? get nodeValue native;
on no setter inherited#
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
Events get on => new Events(this);
onAbort no setter#
Stream of abort events handled by this Document.
Implementation
Stream<Event> get onAbort => Element.abortEvent.forTarget(this);
onBeforeCopy no setter#
Stream of beforecopy events handled by this Document.
Implementation
Stream<Event> get onBeforeCopy => Element.beforeCopyEvent.forTarget(this);
onBeforeCut no setter#
Stream of beforecut events handled by this Document.
Implementation
Stream<Event> get onBeforeCut => Element.beforeCutEvent.forTarget(this);
onBeforePaste no setter#
Stream of beforepaste events handled by this Document.
Implementation
Stream<Event> get onBeforePaste => Element.beforePasteEvent.forTarget(this);
onBlur no setter#
Stream of blur events handled by this Document.
Implementation
Stream<Event> get onBlur => Element.blurEvent.forTarget(this);
onCanPlay no setter#
Implementation
Stream<Event> get onCanPlay => Element.canPlayEvent.forTarget(this);
onCanPlayThrough no setter#
Implementation
Stream<Event> get onCanPlayThrough =>
Element.canPlayThroughEvent.forTarget(this);
onChange no setter#
Stream of change events handled by this Document.
Implementation
Stream<Event> get onChange => Element.changeEvent.forTarget(this);
onClick no setter#
Stream of click events handled by this Document.
Implementation
Stream<MouseEvent> get onClick => Element.clickEvent.forTarget(this);
onContextMenu no setter#
Stream of contextmenu events handled by this Document.
Implementation
Stream<MouseEvent> get onContextMenu =>
Element.contextMenuEvent.forTarget(this);
onCopy no setter#
Stream of copy events handled by this Document.
Implementation
Stream<ClipboardEvent> get onCopy => Element.copyEvent.forTarget(this);
onCut no setter#
Stream of cut events handled by this Document.
Implementation
Stream<ClipboardEvent> get onCut => Element.cutEvent.forTarget(this);
onDoubleClick no setter#
Stream of doubleclick events handled by this Document.
Implementation
@DomName('Document.ondblclick')
Stream<Event> get onDoubleClick => Element.doubleClickEvent.forTarget(this);
onDrag no setter#
Stream of drag events handled by this Document.
Implementation
Stream<MouseEvent> get onDrag => Element.dragEvent.forTarget(this);
onDragEnd no setter#
Stream of dragend events handled by this Document.
Implementation
Stream<MouseEvent> get onDragEnd => Element.dragEndEvent.forTarget(this);
onDragEnter no setter#
Stream of dragenter events handled by this Document.
Implementation
Stream<MouseEvent> get onDragEnter => Element.dragEnterEvent.forTarget(this);
onDragLeave no setter#
Stream of dragleave events handled by this Document.
Implementation
Stream<MouseEvent> get onDragLeave => Element.dragLeaveEvent.forTarget(this);
onDragOver no setter#
Stream of dragover events handled by this Document.
Implementation
Stream<MouseEvent> get onDragOver => Element.dragOverEvent.forTarget(this);
onDragStart no setter#
Stream of dragstart events handled by this Document.
Implementation
Stream<MouseEvent> get onDragStart => Element.dragStartEvent.forTarget(this);
onDrop no setter#
Stream of drop events handled by this Document.
Implementation
Stream<MouseEvent> get onDrop => Element.dropEvent.forTarget(this);
onDurationChange no setter#
Implementation
Stream<Event> get onDurationChange =>
Element.durationChangeEvent.forTarget(this);
onEmptied no setter#
Implementation
Stream<Event> get onEmptied => Element.emptiedEvent.forTarget(this);
onEnded no setter#
Implementation
Stream<Event> get onEnded => Element.endedEvent.forTarget(this);
onError no setter#
Stream of error events handled by this Document.
Implementation
Stream<Event> get onError => Element.errorEvent.forTarget(this);
onFocus no setter#
Stream of focus events handled by this Document.
Implementation
Stream<Event> get onFocus => Element.focusEvent.forTarget(this);
onFullscreenChange no setter#
Stream of fullscreenchange events handled by this Document.
Implementation
Stream<Event> get onFullscreenChange =>
Element.fullscreenChangeEvent.forTarget(this);
onFullscreenError no setter#
Stream of fullscreenerror events handled by this Document.
Implementation
Stream<Event> get onFullscreenError =>
Element.fullscreenErrorEvent.forTarget(this);
onInput no setter#
Stream of input events handled by this Document.
Implementation
Stream<Event> get onInput => Element.inputEvent.forTarget(this);
onInvalid no setter#
Stream of invalid events handled by this Document.
Implementation
Stream<Event> get onInvalid => Element.invalidEvent.forTarget(this);
onKeyDown no setter#
Stream of keydown events handled by this Document.
Implementation
Stream<KeyboardEvent> get onKeyDown => Element.keyDownEvent.forTarget(this);
onKeyPress no setter#
Stream of keypress events handled by this Document.
Implementation
Stream<KeyboardEvent> get onKeyPress => Element.keyPressEvent.forTarget(this);
onKeyUp no setter#
Stream of keyup events handled by this Document.
Implementation
Stream<KeyboardEvent> get onKeyUp => Element.keyUpEvent.forTarget(this);
onLoad no setter#
Stream of load events handled by this Document.
Implementation
Stream<Event> get onLoad => Element.loadEvent.forTarget(this);
onLoadedData no setter#
Implementation
Stream<Event> get onLoadedData => Element.loadedDataEvent.forTarget(this);
onLoadedMetadata no setter#
Implementation
Stream<Event> get onLoadedMetadata =>
Element.loadedMetadataEvent.forTarget(this);
onMouseDown no setter#
Stream of mousedown events handled by this Document.
Implementation
Stream<MouseEvent> get onMouseDown => Element.mouseDownEvent.forTarget(this);
onMouseEnter no setter#
Stream of mouseenter events handled by this Document.
Implementation
Stream<MouseEvent> get onMouseEnter =>
Element.mouseEnterEvent.forTarget(this);
onMouseLeave no setter#
Stream of mouseleave events handled by this Document.
Implementation
Stream<MouseEvent> get onMouseLeave =>
Element.mouseLeaveEvent.forTarget(this);
onMouseMove no setter#
Stream of mousemove events handled by this Document.
Implementation
Stream<MouseEvent> get onMouseMove => Element.mouseMoveEvent.forTarget(this);
onMouseOut no setter#
Stream of mouseout events handled by this Document.
Implementation
Stream<MouseEvent> get onMouseOut => Element.mouseOutEvent.forTarget(this);
onMouseOver no setter#
Stream of mouseover events handled by this Document.
Implementation
Stream<MouseEvent> get onMouseOver => Element.mouseOverEvent.forTarget(this);
onMouseUp no setter#
Stream of mouseup events handled by this Document.
Implementation
Stream<MouseEvent> get onMouseUp => Element.mouseUpEvent.forTarget(this);
onMouseWheel no setter#
Stream of mousewheel events handled by this Document.
Implementation
Stream<WheelEvent> get onMouseWheel =>
Element.mouseWheelEvent.forTarget(this);
onPaste no setter#
Stream of paste events handled by this Document.
Implementation
Stream<ClipboardEvent> get onPaste => Element.pasteEvent.forTarget(this);
onPause no setter#
Implementation
Stream<Event> get onPause => Element.pauseEvent.forTarget(this);
onPlay no setter#
Implementation
Stream<Event> get onPlay => Element.playEvent.forTarget(this);
onPlaying no setter#
Implementation
Stream<Event> get onPlaying => Element.playingEvent.forTarget(this);
onPointerLockChange no setter#
Implementation
Stream<Event> get onPointerLockChange =>
pointerLockChangeEvent.forTarget(this);
onPointerLockError no setter#
Implementation
Stream<Event> get onPointerLockError => pointerLockErrorEvent.forTarget(this);
onRateChange no setter#
Implementation
Stream<Event> get onRateChange => Element.rateChangeEvent.forTarget(this);
onReadyStateChange no setter#
Stream of readystatechange events handled by this Document.
Implementation
Stream<Event> get onReadyStateChange => readyStateChangeEvent.forTarget(this);
onReset no setter#
Stream of reset events handled by this Document.
Implementation
Stream<Event> get onReset => Element.resetEvent.forTarget(this);
onResize no setter#
Implementation
Stream<Event> get onResize => Element.resizeEvent.forTarget(this);
onScroll no setter#
Stream of scroll events handled by this Document.
Implementation
Stream<Event> get onScroll => Element.scrollEvent.forTarget(this);
onSearch no setter#
Stream of search events handled by this Document.
Implementation
Stream<Event> get onSearch => Element.searchEvent.forTarget(this);
onSecurityPolicyViolation no setter#
Stream of securitypolicyviolation events handled by this Document.
Implementation
Stream<SecurityPolicyViolationEvent> get onSecurityPolicyViolation =>
securityPolicyViolationEvent.forTarget(this);
onSeeked no setter#
Implementation
Stream<Event> get onSeeked => Element.seekedEvent.forTarget(this);
onSeeking no setter#
Implementation
Stream<Event> get onSeeking => Element.seekingEvent.forTarget(this);
onSelect no setter#
Stream of select events handled by this Document.
Implementation
Stream<Event> get onSelect => Element.selectEvent.forTarget(this);
onSelectionChange no setter#
Stream of selectionchange events handled by this Document.
Implementation
Stream<Event> get onSelectionChange => selectionChangeEvent.forTarget(this);
onSelectStart no setter#
Stream of selectstart events handled by this Document.
Implementation
Stream<Event> get onSelectStart => Element.selectStartEvent.forTarget(this);
onStalled no setter#
Implementation
Stream<Event> get onStalled => Element.stalledEvent.forTarget(this);
onSubmit no setter#
Stream of submit events handled by this Document.
Implementation
Stream<Event> get onSubmit => Element.submitEvent.forTarget(this);
onSuspend no setter#
Implementation
Stream<Event> get onSuspend => Element.suspendEvent.forTarget(this);
onTimeUpdate no setter#
Implementation
Stream<Event> get onTimeUpdate => Element.timeUpdateEvent.forTarget(this);
onTouchCancel no setter#
Stream of touchcancel events handled by this Document.
Implementation
Stream<TouchEvent> get onTouchCancel =>
Element.touchCancelEvent.forTarget(this);
onTouchEnd no setter#
Stream of touchend events handled by this Document.
Implementation
Stream<TouchEvent> get onTouchEnd => Element.touchEndEvent.forTarget(this);
onTouchMove no setter#
Stream of touchmove events handled by this Document.
Implementation
Stream<TouchEvent> get onTouchMove => Element.touchMoveEvent.forTarget(this);
onTouchStart no setter#
Stream of touchstart events handled by this Document.
Implementation
Stream<TouchEvent> get onTouchStart =>
Element.touchStartEvent.forTarget(this);
onVolumeChange no setter#
Implementation
Stream<Event> get onVolumeChange => Element.volumeChangeEvent.forTarget(this);
onWaiting no setter#
Implementation
Stream<Event> get onWaiting => Element.waitingEvent.forTarget(this);
origin no setter#
Implementation
String? get origin native;
ownerDocument no setter inherited#
The document this node belongs to.
Returns null if this node does not belong to any document.
Other resources
- Node.ownerDocument from MDN.
Inherited from Node.
Implementation
Document? get ownerDocument native;
parent no setter inherited#
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 from W3C.
Inherited from Node.
Implementation
@JSName('parentElement')
/**
* 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://developer.mozilla.org/en-US/docs/Web/API/Node.parentElement)
* from W3C.
*/
Element? get parent native;
parentNode no setter inherited#
The parent node of this node.
Other resources
- Node.parentNode from MDN.
Inherited from Node.
Implementation
Node? get parentNode native;
pointerLockElement no setter#
Implementation
Element? get pointerLockElement native;
previousNode no setter inherited#
The previous sibling node.
Other resources
- Node.previousSibling from MDN.
Inherited from Node.
Implementation
@JSName('previousSibling')
/**
* The previous sibling node.
*
* ## Other resources
*
* * [Node.previousSibling](https://developer.mozilla.org/en-US/docs/Web/API/Node.previousSibling)
* from MDN.
*/
Node? get previousNode native;
readyState no setter#
Implementation
String? get readyState native;
rootElement no setter#
Implementation
SvgSvgElement? get rootElement native;
rootScroller read / write#
Implementation
Element? get rootScroller native;
set rootScroller(Element? value) native;
runtimeType no setter inherited#
Inherited from Interceptor.
Implementation
Type get runtimeType =>
getRuntimeTypeOfInterceptorNotArray(getInterceptor(this), this);
scrollingElement no setter#
Implementation
Element? get scrollingElement native;
suborigin no setter#
Implementation
String? get suborigin native;
text read / write inherited#
All text within this node and its descendants.
Other resources
- Node.textContent from MDN.
Inherited from Node.
Implementation
@JSName('textContent')
/**
* All text within this node and its descendants.
*
* ## Other resources
*
* * [Node.textContent](https://developer.mozilla.org/en-US/docs/Web/API/Node.textContent)
* from MDN.
*/
String? get text native;
@JSName('textContent')
set text(String? value) native;
timeline no setter#
Implementation
DocumentTimeline? get timeline native;
visibilityState no setter#
Implementation
@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#
Implementation
WindowBase? get window => _convertNativeToDart_Window(this._get_window);
Methods#
addEventListener() inherited#
Inherited from EventTarget.
Implementation
void addEventListener(
String type,
EventListener? listener, [
bool? useCapture,
]) {
// TODO(leafp): This check is avoid a bug in our dispatch code when
// listener is null. The browser treats this call as a no-op in this
// case, so it's fine to short-circuit it, but we should not have to.
if (listener != null) {
_addEventListener(type, listener, useCapture);
}
}
adoptNode()#
Implementation
Node adoptNode(Node node) native;
append() inherited#
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
@JSName('appendChild')
/**
* 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.
*/
Node append(Node node) native;
clone() inherited#
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 from MDN.
Inherited from Node.
Implementation
@JSName('cloneNode')
/**
* 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://developer.mozilla.org/en-US/docs/Web/API/Node.cloneNode)
* from MDN.
*/
Node clone(bool? deep) native;
contains() inherited#
Returns true if this node contains the specified node.
Other resources
- Node.contains from MDN.
Inherited from Node.
Implementation
bool contains(Node? other) native;
createDocumentFragment()#
Implementation
DocumentFragment createDocumentFragment() native;
createElement()#
Implementation
@pragma('dart2js:tryInline') // Almost all call sites have one argument.
Element createElement(String tagName, [String? typeExtension]) {
return (typeExtension == null)
? _createElement_2(tagName)
: _createElement(tagName, typeExtension);
}
createElementNS()#
Implementation
Element createElementNS(
String namespaceURI,
String qualifiedName, [
String? typeExtension,
]) {
return (typeExtension == null)
? _createElementNS_2(namespaceURI, qualifiedName)
: _createElementNS(namespaceURI, qualifiedName, typeExtension);
}
createRange()#
Implementation
Range createRange() native;
dispatchEvent() inherited#
Inherited from EventTarget.
Implementation
bool dispatchEvent(Event event) native;
elementsFromPoint()#
Implementation
List<Element> elementsFromPoint(int x, int y) native;
execCommand()#
Implementation
bool execCommand(String commandId, [bool? showUI, String? value]) native;
exitFullscreen()#
Implementation
void exitFullscreen() native;
exitPointerLock()#
Implementation
void exitPointerLock() native;
getAnimations()#
Implementation
List<Animation> getAnimations() native;
getElementById()#
Implementation
Element? getElementById(String elementId) native;
getElementsByClassName()#
Implementation
@Creates('NodeList|HtmlCollection')
@Returns('NodeList|HtmlCollection')
List<Node> getElementsByClassName(String classNames) native;
getElementsByName()#
Implementation
@Creates('NodeList|HtmlCollection')
@Returns('NodeList|HtmlCollection')
List<Node> getElementsByName(String elementName) native;
getElementsByTagName()#
Implementation
@Creates('NodeList|HtmlCollection')
@Returns('NodeList|HtmlCollection')
List<Node> getElementsByTagName(String localName) native;
getRootNode() inherited#
Inherited from Node.
Implementation
Node getRootNode([Map? options]) {
if (options != null) {
var options_1 = convertDartToNative_Dictionary(options);
return _getRootNode_1(options_1);
}
return _getRootNode_2();
}
hasChildNodes() inherited#
Returns true if this node has any children.
Other resources
- Node.hasChildNodes from MDN.
Inherited from Node.
Implementation
bool hasChildNodes() native;
importNode()#
Implementation
Node importNode(Node node, [bool? deep]) native;
insertAllBefore() inherited#
Inserts all of the nodes into this node directly before child.
See also:
Inherited from Node.
Implementation
void insertAllBefore(Iterable<Node> newNodes, Node child) {
if (newNodes is _ChildNodeListLazy) {
_ChildNodeListLazy otherList = newNodes;
if (identical(otherList._this, this)) {
throw new ArgumentError(newNodes);
}
// 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#
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
- Node.insertBefore from MDN.
Inherited from Node.
Implementation
Node insertBefore(Node node, Node? child) native;
noSuchMethod() inherited#
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:
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:
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
dynamic noSuchMethod(Invocation invocation) {
throw NoSuchMethodError.withInvocation(this, invocation);
}
queryCommandEnabled()#
Implementation
bool queryCommandEnabled(String commandId) native;
queryCommandIndeterm()#
Implementation
bool queryCommandIndeterm(String commandId) native;
queryCommandState()#
Implementation
bool queryCommandState(String commandId) native;
queryCommandSupported()#
Implementation
bool queryCommandSupported(String commandId) native;
queryCommandValue()#
Implementation
String queryCommandValue(String commandId) native;
querySelector()#
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.
var element1 = document.querySelector('.className');
var element2 = document.querySelector('#id');
For details about CSS selector syntax, see the CSS selector specification.
Implementation
Element? querySelector(String selectors) native;
querySelectorAll()#
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.
var items = document.querySelectorAll('.itemClassName');
For details about CSS selector syntax, see the CSS selector specification.
Implementation
ElementList<T> querySelectorAll<T extends Element>(String selectors) =>
new _FrozenElementList<T>._wrap(_querySelectorAll(selectors));
remove() inherited#
Removes this node from the DOM.
Inherited from Node.
Implementation
void remove() {
// TODO(jacobr): should we throw an exception if parent is already null?
// TODO(vsm): Use the native remove when available.
if (this.parentNode != null) {
final Node parent = this.parentNode!;
parent._removeChild(this);
}
}
removeEventListener() inherited#
Inherited from EventTarget.
Implementation
void removeEventListener(
String type,
EventListener? listener, [
bool? useCapture,
]) {
// TODO(leafp): This check is avoid a bug in our dispatch code when
// listener is null. The browser treats this call as a no-op in this
// case, so it's fine to short-circuit it, but we should not have to.
if (listener != null) {
_removeEventListener(type, listener, useCapture);
}
}
replaceWith() inherited#
Replaces this node with another node.
Inherited from Node.
Implementation
Node replaceWith(Node otherNode) {
try {
final Node parent = this.parentNode!;
parent._replaceChild(otherNode, this);
} catch (e) {}
return this;
}
toString() inherited#
Print out a String representation of this Node.
Inherited from Node.
Implementation
String toString() {
String? value = nodeValue; // Fetch DOM Node property once.
return value == null ? super.toString() : value;
}
Operators#
operator ==() inherited#
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 == omust be true.-
Symmetric: For all objects
o1ando2,o1 == o2ando2 == o1must either both be true, or both be false. -
Transitive: For all objects
o1,o2, ando3, ifo1 == o2ando2 == o3are true, theno1 == o3must 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
bool operator ==(Object other) => identical(this, other);
Constants#
pointerLockChangeEvent#
Implementation
static const EventStreamProvider<Event> pointerLockChangeEvent =
const EventStreamProvider<Event>('pointerlockchange');
pointerLockErrorEvent#
Implementation
static const EventStreamProvider<Event> pointerLockErrorEvent =
const EventStreamProvider<Event>('pointerlockerror');
readyStateChangeEvent#
Static factory designed to expose readystatechange events to event
handlers that are not necessarily instances of Document.
See EventStreamProvider for usage information.
Implementation
static const EventStreamProvider<Event> readyStateChangeEvent =
const EventStreamProvider<Event>('readystatechange');
securityPolicyViolationEvent#
Static factory designed to expose securitypolicyviolation events to event
handlers that are not necessarily instances of Document.
See EventStreamProvider for usage information.
Implementation
static const EventStreamProvider<SecurityPolicyViolationEvent>
securityPolicyViolationEvent =
const EventStreamProvider<SecurityPolicyViolationEvent>(
'securitypolicyviolation',
);
selectionChangeEvent#
Static factory designed to expose selectionchange events to event
handlers that are not necessarily instances of Document.
See EventStreamProvider for usage information.
Implementation
static const EventStreamProvider<Event> selectionChangeEvent =
const EventStreamProvider<Event>('selectionchange');