Document extension type
The Document
interface represents any web page loaded in the browser
and serves as an entry point into the web page's content, which is the
DOM tree.
The DOM tree includes elements such as body
and table
, among
many others. It
provides functionality globally to the document, like how to obtain the
page's URL and create new elements in the document.
The Document
interface describes the common properties and methods for any
kind of document. Depending on the document's type (e.g.
HTML,
XML, SVG, …), a larger
API is available: HTML documents, served with the "text/html"
content
type, also implement the HTMLDocument
interface, whereas XML and SVG
documents implement the XMLDocument interface.
API documentation sourced from MDN Web Docs.
- on
- Implemented types
- Available extensions
Constructors
- Document()
-
factory
Properties
- activeElement → Element?
-
The
activeElement
read-only property of the Document interface returns the Element within the DOM that currently has focus.no setter -
adoptedStyleSheets
↔ JSArray<
CSSStyleSheet> -
The
adoptedStyleSheets
property of the Document interface is used for setting an array of constructed stylesheets to be used by the document.getter/setter pair - alinkColor ↔ String
-
Returns or sets the color of an active link in the document body. A link
is active
during the time between
mousedown
andmouseup
events.getter/setter pair - all → HTMLAllCollection
-
The Document interface's read-only
all
property returns an HTMLAllCollection rooted at the document node.no setter - anchors → HTMLCollection
-
The
anchors
read-only property of the Document interface returns a list of all of the anchors in the document.no setter - applets → HTMLCollection
-
The
applets
property of the Document returns an empty HTMLCollection. This property is kept only for compatibility reasons; in older versions of browsers, it returned a list of the applets within a document.no setter - baseURI → String
-
The read-only
baseURI
property of the Node interface returns the absolute base URL of the document containing the node.no setterinherited - bgColor ↔ String
-
The deprecated
bgColor
property gets or sets the background color of the current document.getter/setter pair - body ↔ HTMLElement?
-
The
Document.body
property represents thebody
orframeset
node of the current document, ornull
if no such element exists.getter/setter pair - characterSet → String
-
The
Document.characterSet
read-only property returns the character encoding of the document that it's currently rendered with.no setter - childElementCount → int
-
The
Document.childElementCount
read-only property returns the number of child elements of the document.no setter - childNodes → NodeList
-
The read-only
childNodes
property of the Node interface returns a live NodeList of child Node of the given element where the first child node is assigned index0
. Child nodes include elements, text and comments.no setterinherited - children → HTMLCollection
-
The read-only
children
property returns a live HTMLCollection which contains all of the child Element of the document upon which it was called.no setter - compatMode → String
-
The
Document.compatMode
read-only property indicates whether the document is rendered in Quirks mode or Standards mode.no setter - contentType → String
-
The
Document.contentType
read-only property returns the MIME type that the document is being rendered as. This may come from HTTP headers or other sources of MIME information, and might be affected by automatic type conversions performed by either the browser or extensions.no setter -
The Document property
cookie
lets you read and write cookies associated with the document. It serves as a getter and setter for the actual values of the cookies.getter/setter pair - currentScript → HTMLOrSVGScriptElement?
-
The
Document.currentScript
property returns thescript
element whose script is currently being processed and isn't a JavaScript module. (For modules useimport.meta
instead.)no setter - defaultView → Window?
-
In browsers,
document.defaultView
returns the Window object associated with , ornull
if none is available.no setter - designMode ↔ String
-
document.designMode
controls whether the entire document is editable. Valid values are"on"
and"off"
. According to the specification, this property is meant to default to"off"
. Firefox follows this standard. The earlier versions of Chrome and IE default to"inherit"
. Starting in Chrome 43, the default is"off"
and"inherit"
is no longer supported. In IE6-10, the value is capitalized.getter/setter pair - dir ↔ String
-
The
Document.dir
property is a string representing the directionality of the text of the document, whether left to right (default) or right to left. Possible values are'rtl'
, right to left, and'ltr'
, left to right.getter/setter pair - doctype → DocumentType?
-
The
doctype
read-only property of the Document interface is a DocumentType object representing the the associated with the current document.no setter - documentElement → Element?
-
The
documentElement
read-only property of the Document interface returns the Element that is the root element of the document (for example, thehtml
element for HTML documents).no setter - documentURI → String
-
The
documentURI
read-only property of the Document interface returns the document location as a string.no setter - domain ↔ String
-
The
domain
property of the Document interface gets/sets the domain portion of the of the current document, as used by the same-origin policy.getter/setter pair - embeds → HTMLCollection
-
The
embeds
read-only property of the Document interface returns a list of the embeddedembed
elements within the current document.no setter - fgColor ↔ String
-
fgColor
gets/sets the foreground color, or text color, of the current document.getter/setter pair - firstChild → Node?
-
The read-only
firstChild
property of the Node interface returns the node's first child in the tree, ornull
if the node has no children.no setterinherited - firstElementChild → Element?
-
The
Document.firstElementChild
read-only property returns the document's first child Element, ornull
if there are no child elements.no setter - fonts → FontFaceSet
-
The
fonts
property of the Document interface returns the FontFaceSet interface of the document.no setter - forms → HTMLCollection
-
The
forms
read-only property of the Document interface returns an HTMLCollection listing all theform
elements contained in the document.no setter - fullscreen → bool
-
The obsolete Document interface's
fullscreen
read-only property reports whether or not the document is currently displaying content in fullscreen mode.no setter - fullscreenElement → Element?
-
The
Document.fullscreenElement
read-only property returns the Element that is currently being presented in fullscreen mode in this document, ornull
if fullscreen mode is not currently in use.no setter - fullscreenEnabled → bool
-
The read-only
fullscreenEnabled
property on the Document interface indicates whether or not fullscreen mode is available.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- head → HTMLHeadElement?
-
The
head
read-only property of the Document interface returns thehead
element of the current document.no setter -
The
Document.hidden
read-only property returns a Boolean value indicating if the page is considered hidden or not.no setter - images → HTMLCollection
-
The
images
read-only property of the Document interface returns a collection of the images in the current HTML document.no setter - implementation → DOMImplementation
-
The
Document.implementation
property returns a DOMImplementation object associated with the current document.no setter - isConnected → bool
-
The read-only
isConnected
property of the Node interface returns a boolean indicating whether the node is connected (directly or indirectly) to a Document object.no setterinherited - isDefinedAndNotNull → bool
-
Available on JSAny?, provided by the NullableUndefineableJSAnyExtension extension
no setter - isNull → bool
-
Available on JSAny?, provided by the NullableUndefineableJSAnyExtension extension
Whether this value corresponds to JavaScriptnull
.no setter - isTruthy → JSBoolean
-
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of!!
in JavaScript.this
no setter - isUndefined → bool
-
Available on JSAny?, provided by the NullableUndefineableJSAnyExtension extension
Whether this value corresponds to JavaScriptundefined
.no setter - isUndefinedOrNull → bool
-
Available on JSAny?, provided by the NullableUndefineableJSAnyExtension extension
no setter - lastChild → Node?
-
The read-only
lastChild
property of the Node interface returns the last child of the node, ornull
if there are no child nodes.no setterinherited - lastElementChild → Element?
-
The
Document.lastElementChild
read-only property returns the document's last child Element, ornull
if there are no child elements.no setter - lastModified → String
-
The
lastModified
property of the Document interface returns a string containing the date and local time on which the current document was last modified.no setter - linkColor ↔ String
-
The
Document.linkColor
property gets/sets the color of links within the document.getter/setter pair - links → HTMLCollection
-
The
links
read-only property of the Document interface returns a collection of allarea
elements anda
elements in a document with a value for the href attribute.no setter - location → Location?
-
The
Document.location
read-only property returns a Location object, which contains information about the URL of the document and provides methods for changing that URL and loading another URL.no setter - nextSibling → Node?
-
The read-only
nextSibling
property of the Node interface returns the node immediately following the specified one in their parent's Node.childNodes, or returnsnull
if the specified node is the last child in the parent element.no setterinherited - nodeName → String
-
The read-only
nodeName
property of Node returns the name of the current node as a string.no setterinherited - nodeType → int
-
The read-only
nodeType
property of a Node interface is an integer that identifies what the node is. It distinguishes different kind of nodes from each other, such as Element, Text and Comment.no setterinherited - nodeValue ↔ String?
-
The
nodeValue
property of the Node interface returns or sets the value of the current node.getter/setter pairinherited - not → JSBoolean
-
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of!
in JavaScript.this
no setter - onabort ↔ EventHandler?
-
getter/setter pair
- onanimationcancel ↔ EventHandler?
-
getter/setter pair
- onanimationend ↔ EventHandler?
-
getter/setter pair
- onanimationiteration ↔ EventHandler?
-
getter/setter pair
- onanimationstart ↔ EventHandler?
-
getter/setter pair
- onauxclick ↔ EventHandler?
-
getter/setter pair
- onbeforeinput ↔ EventHandler?
-
getter/setter pair
- onbeforetoggle ↔ EventHandler?
-
getter/setter pair
- onblur ↔ EventHandler?
-
getter/setter pair
- oncancel ↔ EventHandler?
-
getter/setter pair
- oncanplay ↔ EventHandler?
-
getter/setter pair
- oncanplaythrough ↔ EventHandler?
-
getter/setter pair
- onchange ↔ EventHandler?
-
getter/setter pair
- onclick ↔ EventHandler?
-
getter/setter pair
- onclose ↔ EventHandler?
-
getter/setter pair
- oncontextlost ↔ EventHandler?
-
getter/setter pair
-
getter/setter pair
- oncontextrestored ↔ EventHandler?
-
getter/setter pair
- oncopy ↔ EventHandler?
-
getter/setter pair
- oncuechange ↔ EventHandler?
-
getter/setter pair
- oncut ↔ EventHandler?
-
getter/setter pair
- ondblclick ↔ EventHandler?
-
getter/setter pair
- ondrag ↔ EventHandler?
-
getter/setter pair
- ondragend ↔ EventHandler?
-
getter/setter pair
- ondragenter ↔ EventHandler?
-
getter/setter pair
- ondragleave ↔ EventHandler?
-
getter/setter pair
- ondragover ↔ EventHandler?
-
getter/setter pair
- ondragstart ↔ EventHandler?
-
getter/setter pair
- ondrop ↔ EventHandler?
-
getter/setter pair
- ondurationchange ↔ EventHandler?
-
getter/setter pair
- onemptied ↔ EventHandler?
-
getter/setter pair
- onended ↔ EventHandler?
-
getter/setter pair
- onerror ↔ OnErrorEventHandler?
-
getter/setter pair
- onfocus ↔ EventHandler?
-
getter/setter pair
- onformdata ↔ EventHandler?
-
getter/setter pair
- onfullscreenchange ↔ EventHandler?
-
getter/setter pair
- onfullscreenerror ↔ EventHandler?
-
getter/setter pair
- ongotpointercapture ↔ EventHandler?
-
getter/setter pair
- oninput ↔ EventHandler?
-
getter/setter pair
- oninvalid ↔ EventHandler?
-
getter/setter pair
- onkeydown ↔ EventHandler?
-
getter/setter pair
- onkeypress ↔ EventHandler?
-
getter/setter pair
- onkeyup ↔ EventHandler?
-
getter/setter pair
-
onLoad
→ Stream<
Event> -
Available on Document, provided by the DocumentCustomEvents extension
no setter - onload ↔ EventHandler?
-
getter/setter pair
- onloadeddata ↔ EventHandler?
-
getter/setter pair
- onloadedmetadata ↔ EventHandler?
-
getter/setter pair
- onloadstart ↔ EventHandler?
-
getter/setter pair
- onlostpointercapture ↔ EventHandler?
-
getter/setter pair
- onmousedown ↔ EventHandler?
-
getter/setter pair
- onmouseenter ↔ EventHandler?
-
getter/setter pair
- onmouseleave ↔ EventHandler?
-
getter/setter pair
- onmousemove ↔ EventHandler?
-
getter/setter pair
- onmouseout ↔ EventHandler?
-
getter/setter pair
- onmouseover ↔ EventHandler?
-
getter/setter pair
- onmouseup ↔ EventHandler?
-
getter/setter pair
-
onMouseWheel
→ Stream<
WheelEvent> -
Available on Document, provided by the DocumentCustomEvents extension
no setter - onpaste ↔ EventHandler?
-
getter/setter pair
- onpause ↔ EventHandler?
-
getter/setter pair
- onplay ↔ EventHandler?
-
getter/setter pair
- onplaying ↔ EventHandler?
-
getter/setter pair
- onpointercancel ↔ EventHandler?
-
getter/setter pair
- onpointerdown ↔ EventHandler?
-
getter/setter pair
- onpointerenter ↔ EventHandler?
-
getter/setter pair
- onpointerleave ↔ EventHandler?
-
getter/setter pair
- onpointerlockchange ↔ EventHandler?
-
getter/setter pair
- onpointerlockerror ↔ EventHandler?
-
getter/setter pair
- onpointermove ↔ EventHandler?
-
getter/setter pair
- onpointerout ↔ EventHandler?
-
getter/setter pair
- onpointerover ↔ EventHandler?
-
getter/setter pair
- onpointerup ↔ EventHandler?
-
getter/setter pair
- onprogress ↔ EventHandler?
-
getter/setter pair
- onratechange ↔ EventHandler?
-
getter/setter pair
- onreadystatechange ↔ EventHandler?
-
getter/setter pair
- onreset ↔ EventHandler?
-
getter/setter pair
- onresize ↔ EventHandler?
-
getter/setter pair
- onscroll ↔ EventHandler?
-
getter/setter pair
- onscrollend ↔ EventHandler?
-
getter/setter pair
- onsecuritypolicyviolation ↔ EventHandler?
-
getter/setter pair
- onseeked ↔ EventHandler?
-
getter/setter pair
- onseeking ↔ EventHandler?
-
getter/setter pair
- onselect ↔ EventHandler?
-
getter/setter pair
- onselectionchange ↔ EventHandler?
-
getter/setter pair
- onselectstart ↔ EventHandler?
-
getter/setter pair
- onslotchange ↔ EventHandler?
-
getter/setter pair
- onstalled ↔ EventHandler?
-
getter/setter pair
- onsubmit ↔ EventHandler?
-
getter/setter pair
- onsuspend ↔ EventHandler?
-
getter/setter pair
- ontimeupdate ↔ EventHandler?
-
getter/setter pair
- ontoggle ↔ EventHandler?
-
getter/setter pair
- ontouchcancel ↔ EventHandler?
-
getter/setter pair
- ontouchend ↔ EventHandler?
-
getter/setter pair
- ontouchmove ↔ EventHandler?
-
getter/setter pair
- ontouchstart ↔ EventHandler?
-
getter/setter pair
- ontransitioncancel ↔ EventHandler?
-
getter/setter pair
- ontransitionend ↔ EventHandler?
-
getter/setter pair
- ontransitionrun ↔ EventHandler?
-
getter/setter pair
- ontransitionstart ↔ EventHandler?
-
getter/setter pair
-
onVisibilityChange
→ Stream<
Event> -
Available on Document, provided by the DocumentCustomEvents extension
no setter - onvisibilitychange ↔ EventHandler?
-
getter/setter pair
- onvolumechange ↔ EventHandler?
-
getter/setter pair
- onwaiting ↔ EventHandler?
-
getter/setter pair
- onwheel ↔ EventHandler?
-
getter/setter pair
- ownerDocument → Document?
-
The read-only
ownerDocument
property of the Node interface returns the top-level document object of the node.no setterinherited - parentElement → Element?
-
The read-only
parentElement
property of Node interface returns the DOM node's parent Element, ornull
if the node either has no parent, or its parent isn't a DOM Element.no setterinherited - parentNode → Node?
-
The read-only
parentNode
property of the Node interface returns the parent of the specified node in the DOM tree.no setterinherited - pictureInPictureElement → Element?
-
The read-only
pictureInPictureElement
property of the Document interface returns the Element that is currently being presented in picture-in-picture mode in this document, ornull
if picture-in-picture mode is not currently in use.no setter - pictureInPictureEnabled → bool
-
The read-only
pictureInPictureEnabled
property of the Document interface indicates whether or not picture-in-picture mode is available.no setter - plugins → HTMLCollection
-
The
plugins
read-only property of the Document interface returns an HTMLCollection object containing one or more HTMLEmbedElements representing theembed
elements in the current document.no setter - pointerLockElement → Element?
-
The
pointerLockElement
read-only property of the Document interface provides the element set as the target for mouse events while the pointer is locked. It isnull
if lock is pending, pointer is unlocked, or the target is in another document.no setter - previousSibling → Node?
-
The read-only
previousSibling
property of the Node interface returns the node immediately preceding the specified one in its parent's Node.childNodes list, ornull
if the specified node is the first in that list.no setterinherited - readyState → DocumentReadyState
-
The
Document.readyState
property describes the loading state of the document. When the value of this property changes, aDocument.readystatechange_event
event fires on the document object.no setter - referrer → String
-
The
Document.referrer
property returns the URI of the page that linked to this page.no setter - rootElement → SVGSVGElement?
-
Document.rootElement
returns the Element that is the root element of the document if it is an element, otherwisenull
. It is deprecated in favor of Document.documentElement, which returns the root element for all documents.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scripts → HTMLCollection
-
The
scripts
property of the Document interface returns a list of thescript
elements in the document. The returned object is an HTMLCollection.no setter - scrollingElement → Element?
-
The
scrollingElement
read-only property of the Document interface returns a reference to the Element that scrolls the document. In standards mode, this is the root element of the document,document.documentElement
.no setter - styleSheets → StyleSheetList
-
The
styleSheets
read-only property of the Document interface returns a StyleSheetList of CSSStyleSheet objects, for stylesheets explicitly linked into or embedded in a document.no setter - text ← String
-
Available on Node, provided by the NodeGlue extension
no getter - textContent ↔ String?
-
The
textContent
property of the Node interface represents the text content of the node and its descendants.getter/setter pairinherited - timeline → DocumentTimeline
-
The
timeline
readonly property of the Document interface represents the default timeline of the current document. This timeline is a special instance of DocumentTimeline.no setter - title ↔ String
-
The
document.title
property gets or sets the current title of the document. When present, it defaults to the value of the<title>
.getter/setter pair - URL → String
-
The
URL
read-only property of the Document interface returns the document location as a string.no setter - visibilityState → DocumentVisibilityState
-
The
Document.visibilityState
read-only property returns the visibility of the document. It can be used to check whether the document is in the background or in a minimized window, or is otherwise not visible to the user.no setter - vlinkColor ↔ String
-
The
Document.vlinkColor
property gets/sets the color of links that the user has visited in the document.getter/setter pair
Methods
-
add(
JSAny? any) → JSAny -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
+any
-
addEventListener(
String type, EventListener? callback, [JSAny options]) → void -
The
addEventListener()
method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.inherited -
adoptNode(
Node node) → Node -
Document.adoptNode()
transfers a from another Document into the method's document. The adopted node and its subtree are removed from their original document (if any), and their Node.ownerDocument is changed to the current document. The node can then be inserted into the current document. -
and(
JSAny? any) → JSAny? -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
&&any
-
append(
Node other) → Node -
append(
JSAny nodes) → void -
The
Document.append()
method inserts a set of Node objects or string objects after the last child of the document. String objects are inserted as equivalent Text nodes. -
appendChild(
Node node) → Node -
The
appendChild()
method of the Node interface adds a node to the end of the list of children of a specified parent node.inherited -
callMethod<
R extends JSAny?> (JSAny method, [JSAny? arg1, JSAny? arg2, JSAny? arg3, JSAny? arg4]) → R -
Available on JSObject, provided by the JSObjectUnsafeUtilExtension extension
Callsmethod
on this JSObject with up to four arguments. -
callMethodVarArgs<
R extends JSAny?> (JSAny method, [List< JSAny?> ? arguments]) → R -
Available on JSObject, provided by the JSObjectUnsafeUtilExtension extension
Callsmethod
on this JSObject with a variable number ofarguments
. -
captureEvents(
) → void -
caretPositionFromPoint(
num x, num y, [CaretPositionFromPointOptions options]) → JSObject? -
The
caretPositionFromPoint()
method of the Document interface returns aCaretPosition
object, containing the DOM node, along with the caret and caret's character offset within that node. -
clear(
) → void -
The
Document.clear()
method does nothing, but doesn't raise any error. -
clone(
bool? deep) → Node -
cloneNode(
[bool deep]) → Node -
The
cloneNode()
method of the Node interface returns a duplicate of the node on which this method was called. Its parameter controls if the subtree contained in a node is also cloned or not.inherited -
close(
) → void -
The
Document.close()
method finishes writing to a document, opened with Document.open. -
compareDocumentPosition(
Node other) → int -
The
compareDocumentPosition()
method of the Node interface reports the position of its argument node relative to the node on which it is called.inherited -
contains(
Node? other) → bool -
The
contains()
method of the Node interface returns a boolean value indicating whether a node is a descendant of a given node, that is the node itself, one of its direct children (Node.childNodes), one of the children's direct children, and so on.inherited -
createAttribute(
String localName) → Attr -
The
Document.createAttribute()
method creates a new attribute node, and returns it. The object created is a node implementing the Attr interface. The DOM does not enforce what sort of attributes can be added to a particular element in this manner. -
createAttributeNS(
String? namespace, String qualifiedName) → Attr -
The
Document.createAttributeNS()
method creates a new attribute node with the specified namespace URI and qualified name, and returns it. The object created is a node implementing the Attr interface. The DOM does not enforce what sort of attributes can be added to a particular element in this manner. -
createCDATASection(
String data) → CDATASection -
createCDATASection()
creates a new CDATA section node, and returns it. -
createComment(
String data) → Comment -
createComment()
creates a new comment node, and returns it. -
createDocumentFragment(
) → DocumentFragment - Creates a new empty DocumentFragment into which DOM nodes can be added to build an offscreen DOM tree.
-
createElement(
String localName, [JSAny options]) → Element -
In an HTML document,
the
document.createElement()
method creates the HTML element specified by tagName, or an HTMLUnknownElement if tagName isn't recognized. -
createElementNS(
String? namespace, String qualifiedName, [JSAny options]) → Element - Creates an element with the specified namespace URI and qualified name.
-
createEvent(
String interface) → Event -
Warning: Many methods used with
createEvent
, such asinitCustomEvent
, are deprecated. Use event constructors instead. -
createExpression(
String expression, [XPathNSResolver? resolver]) → XPathExpression - This method compiles an XPathExpression which can then be used for (repeated) evaluations.
-
createNodeIterator(
Node root, [int whatToShow, NodeFilter? filter]) → NodeIterator -
The
Document.createNodeIterator()
method returns a newNodeIterator
object. -
createNSResolver(
Node nodeResolver) → Node -
Creates an
XPathNSResolver
which resolves namespaces with respect to the definitions in scope for a specified node. -
createProcessingInstruction(
String target, String data) → ProcessingInstruction -
createProcessingInstruction()
generates a new processing instruction node and returns it. -
createRange(
) → Range -
The
Document.createRange()
method returns a new Range object. -
createTextNode(
String data) → Text - Creates a new Text node. This method can be used to escape HTML characters.
-
createTreeWalker(
Node root, [int whatToShow, NodeFilter? filter]) → TreeWalker -
The
Document.createTreeWalker()
creator method returns a newly created TreeWalker object. -
dartify(
) → Object? -
Available on JSAny?, provided by the JSAnyUtilityExtension extension
Converts a JavaScript value to the Dart equivalent if possible. -
delete(
JSAny property) → JSBoolean -
Available on JSObject, provided by the JSObjectUnsafeUtilExtension extension
Deletes the property with keyproperty
from this JSObject. -
dispatchEvent(
Event event) → bool -
The
dispatchEvent()
method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually withdispatchEvent()
.inherited -
divide(
JSAny? any) → JSAny -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
/any
-
elementFromPoint(
num x, num y) → Element? -
The
elementFromPoint()
method, available on the Document object, returns the topmost Element at the specified coordinates (relative to the viewport). -
elementsFromPoint(
num x, num y) → JSArray< Element> -
The
elementsFromPoint()
method of the Document interface returns an array of all elements at the specified coordinates (relative to the viewport). The elements are ordered from the topmost to the bottommost box of the viewport. -
equals(
JSAny? any) → JSBoolean -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
==any
-
evaluate(
String expression, Node contextNode, [XPathNSResolver? resolver, int type, XPathResult? result]) → XPathResult -
The
evaluate()
method of the Document interface selects elements based on the XPath expression given in parameters. -
execCommand(
String commandId, [bool showUI, String value]) → bool -
The
execCommand
method implements multiple different commands. Some of them provide access to the clipboard, while others are for editing form inputs,contenteditable
elements or entire documents (when switched to design mode). -
exitFullscreen(
) → JSPromise< JSAny?> -
The Document method
exitFullscreen()
requests that the element on this document which is currently being presented in fullscreen mode be taken out of fullscreen mode, restoring the previous state of the screen. This usually reverses the effects of a previous call to Element.requestFullscreen. -
exitPictureInPicture(
) → JSPromise< JSAny?> -
The
exitPictureInPicture()
method of the Document interface requests that a video contained in this document, which is currently floating, be taken out of picture-in-picture mode, restoring the previous state of the screen. This usually reverses the effects of a previous call to HTMLVideoElement.requestPictureInPicture. -
exitPointerLock(
) → void -
The
exitPointerLock()
method of the Document interface asynchronously releases a pointer lock previously requested through Element.requestPointerLock. -
exponentiate(
JSAny? any) → JSAny -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
**any
-
getAnimations(
) → JSArray< Animation> -
The
getAnimations()
method of the Document interface returns an array of all Animation objects currently in effect whose target elements are descendants of the document. This array includes CSS Animations, CSS Transitions, and Web Animations. -
getElementById(
String elementId) → Element? -
The
getElementById()
method of the Document interface returns an Element object representing the element whose Element.id property matches the specified string. Since element IDs are required to be unique if specified, they're a useful way to get access to a specific element quickly. -
getElementsByClassName(
String classNames) → HTMLCollection -
The
getElementsByClassName
method of Document interface returns an array-like object of all child elements which have all of the given class name(s). -
getElementsByName(
String elementName) → NodeList -
The
getElementsByName()
method of the Document object returns a NodeList Collection of elements with a givenname
attribute in the document. -
getElementsByTagName(
String qualifiedName) → HTMLCollection -
The
getElementsByTagName
method of Document interface returns an HTMLCollection of elements with the given tag name. -
getElementsByTagNameNS(
String? namespace, String localName) → HTMLCollection - Returns a list of elements with the given tag name belonging to the given namespace. The complete document is searched, including the root node.
-
getProperty<
R extends JSAny?> (JSAny property) → R -
Available on JSObject, provided by the JSObjectUnsafeUtilExtension extension
The value of the property keyproperty
of this JSObject. -
getRootNode(
[GetRootNodeOptions options]) → Node -
The
getRootNode()
method of the Node interface returns the context object's root, which optionally includes the shadow root if it is available.inherited -
getSelection(
) → Selection? -
The
getSelection()
method of the Document interface returns a Selection object representing the range of text selected by the user, or the current position of the caret. -
greaterThan(
JSAny? any) → JSBoolean -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
>any
-
greaterThanOrEqualTo(
JSAny? any) → JSBoolean -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
>=any
-
has(
String property) → bool -
Available on JSObject, provided by the JSObjectUnsafeUtilExtension extension
Shorthand helper for hasProperty to check whether this JSObject contains the property keyproperty
, but takes and returns a Dart value. -
hasChildNodes(
) → bool -
The
hasChildNodes()
method of the Node interface returns a boolean value indicating whether the given Node has child nodes or not.inherited -
hasFocus(
) → bool -
The
hasFocus()
method of the Document interface returns a boolean value indicating whether the document or any element inside the document has focus. This method can be used to determine whether the active element in a document has focus. -
hasProperty(
JSAny property) → JSBoolean -
Available on JSObject, provided by the JSObjectUnsafeUtilExtension extension
Whether or not this JSObject contains the property keyproperty
. -
hasStorageAccess(
) → JSPromise< JSBoolean> -
The
hasStorageAccess()
method of the Document interface returns aPromise
that resolves with a boolean value indicating whether the document has access to third-party, unpartitioned cookies. -
hasUnpartitionedCookieAccess(
) → JSPromise< JSBoolean> -
The
hasUnpartitionedCookieAccess()
method of the Document interface returns aPromise
that resolves with a boolean value indicating whether the document has access to third-party, unpartitioned cookies. -
importNode(
Node node, [bool deep]) → Node -
The Document object's
importNode()
method creates a copy of a Node or DocumentFragment from another document, to be inserted into the current document later. -
insertBefore(
Node node, Node? child) → Node -
The
insertBefore()
method of the Node interface inserts a node before a reference node as a child of a specified parent node.inherited -
instanceof(
JSFunction constructor) → bool -
Available on JSAny?, provided by the JSAnyUtilityExtension extension
Whether thisJSAny?
is aninstanceof
constructor
. -
instanceOfString(
String constructorName) → bool -
Available on JSAny?, provided by the JSAnyUtilityExtension extension
Whether thisJSAny?
is aninstanceof
the constructor that is defined byconstructorName
, which is looked up in the globalContext. -
isA<
T extends JSAny?> () → bool -
Available on JSAny?, provided by the JSAnyUtilityExtension extension
Whether thisJSAny?
is an instance of the JavaScript type that is declared byT
. -
isDefaultNamespace(
String? namespace) → bool -
The
isDefaultNamespace()
method of the Node interface accepts a namespace URI as an argument. It returns a boolean value that istrue
if the namespace is the default namespace on the given node andfalse
if not.inherited -
isEqualNode(
Node? otherNode) → bool -
The
isEqualNode()
method of the Node interface tests whether two nodes are equal. Two nodes are equal when they have the same type, defining characteristics (for elements, this would be their ID, number of children, and so forth), its attributes match, and so on. The specific set of data points that must match varies depending on the types of the nodes.inherited -
isSameNode(
Node? otherNode) → bool -
The
isSameNode()
method of the Node interface is a legacy alias the for the===
strict equality operator. That is, it tests whether two nodes are the same (in other words, whether they reference the same object).inherited -
lessThan(
JSAny? any) → JSBoolean -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
<any
-
lessThanOrEqualTo(
JSAny? any) → JSBoolean -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
<=any
-
lookupNamespaceURI(
String? prefix) → String? -
The
lookupNamespaceURI()
method of the Node interface takes a prefix as parameter and returns the namespace URI associated with it on the given node if found (andnull
if not).inherited -
lookupPrefix(
String? namespace) → String? -
The
lookupPrefix()
method of the Node interface returns a string containing the prefix for a given namespace URI, if present, andnull
if not. When multiple prefixes are possible, the first prefix is returned.inherited -
modulo(
JSAny? any) → JSAny -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
%any
-
multiply(
JSAny? any) → JSAny -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
*any
-
normalize(
) → void -
The
normalize()
method of the Node interface puts the specified node and all of its sub-tree into a normalized form. In a normalized sub-tree, no text nodes in the sub-tree are empty and there are no adjacent text nodes.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notEquals(
JSAny? any) → JSBoolean -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
!=any
-
open(
[String unused1OrUrl, String nameOrUnused2, String features]) → JSObject? -
The
Document.open()
method opens a document for Document.write. -
or(
JSAny? any) → JSAny? -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
||any
-
prepend(
JSAny nodes) → void -
The
Document.prepend()
method inserts a set of Node objects or string objects before the first child of the document. String objects are inserted as equivalent Text nodes. -
queryCommandIndeterm(
String commandId) → bool -
queryCommandValue(
String commandId) → String -
querySelector(
String selectors) → Element? -
The Document method
querySelector()
returns the first Element within the document that matches the specified selector, or group of selectors. If no matches are found,null
is returned. -
querySelectorAll(
String selectors) → NodeList -
The Document method
querySelectorAll()
returns a static (not live) NodeList representing a list of the document's elements that match the specified group of selectors. -
releaseEvents(
) → void -
removeChild(
Node child) → Node -
The
removeChild()
method of the Node interface removes a child node from the DOM and returns the removed node.inherited -
removeEventListener(
String type, EventListener? callback, [JSAny options]) → void -
The
removeEventListener()
method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener from the target. The event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see Matching event listeners for removal.inherited -
replaceChild(
Node node, Node child) → Node -
The
replaceChild()
method of the Node interface replaces a child node within the given (parent) node.inherited -
replaceChildren(
JSAny nodes) → void -
The
Document.replaceChildren()
method replaces the existing children of aDocument
with a specified new set of children. -
requestStorageAccess(
) → JSPromise< JSAny?> -
The
requestStorageAccess()
method of the Document interface allows content loaded in a third-party context (i.e., embedded in aniframe
) to request access to third-party cookies and unpartitioned state. This is relevant to user agents that, by default, block access to third-party, unpartitioned cookies to improve privacy (e.g., to prevent tracking), and is part of the Storage Access API. -
setProperty(
JSAny property, JSAny? value) → void -
Available on JSObject, provided by the JSObjectUnsafeUtilExtension extension
Write thevalue
of property keyproperty
of this JSObject. -
startViewTransition(
[JSObject callbackOptions]) → ViewTransition -
The
startViewTransition()
method of the Document interface starts a new same-document (SPA) view transition and returns a ViewTransition object to represent it. -
strictEquals(
JSAny? any) → JSBoolean -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
===any
-
strictNotEquals(
JSAny? any) → JSBoolean -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
!==any
-
subtract(
JSAny? any) → JSAny -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
-any
-
toString(
) → String -
A string representation of this object.
inherited
-
typeofEquals(
String typeString) → bool -
Available on JSAny?, provided by the JSAnyUtilityExtension extension
Whether the result oftypeof
on thisJSAny?
istypeString
. -
unsignedRightShift(
JSAny? any) → JSNumber -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result of
in JavaScript.this
>>>any
-
write(
JSAny text) → void -
Warning: Use of the
document.write()
method is strongly discouraged.As the HTML spec itself warns:
This method has very idiosyncratic behavior. In some cases, this method can affect the state of the
HTML parser while the parser is running, resulting in a DOM that does not correspond to the source of the document (e.g. if the string written is the string "
<plaintext>
" or "<!--
"). In other cases, the call can clear the current page first, as ifdocument.open()
had been called. In yet more cases, the method is simply ignored, or throws an exception. Users agents are explicitly allowed to avoid executingscript
elements inserted via this method. And to make matters even worse, the exact behavior of this method can in some cases be dependent on network latency, which can lead to failures that are very hard to debug. For all these reasons, use of this method is strongly discouraged.Therefore, avoid using
document.write()
— and if possible, update any existing code that is still using it. -
writeln(
JSAny text) → void -
Warning: Use of the
document.writeln()
method is strongly discouraged.As the HTML spec itself warns:
This method has very idiosyncratic behavior. In some cases, this method can affect the state of the
HTML parser while the parser is running, resulting in a DOM that does not correspond to the source of the document (e.g. if the string written is the string "
<plaintext>
" or "<!--
"). In other cases, the call can clear the current page first, as ifdocument.open()
had been called. In yet more cases, the method is simply ignored, or throws an exception. Users agents are explicitly allowed to avoid executingscript
elements inserted via this method. And to make matters even worse, the exact behavior of this method can in some cases be dependent on network latency, which can lead to failures that are very hard to debug. For all these reasons, use of this method is strongly discouraged.Therefore, avoid using
document.writeln()
— and if possible, update any existing code that is still using it.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
String name) → JSObject -
operator [](
String property) → JSAny? -
Available on JSObject, provided by the JSObjectUnsafeUtilExtension extension
Shorthand helper for getProperty to get the value of the property keyproperty
of this JSObject, but takes and returns a Dart value. -
operator []=(
String property, JSAny? value) → void -
Available on JSObject, provided by the JSObjectUnsafeUtilExtension extension
Shorthand helper for setProperty to write thevalue
of the property keyproperty
of this JSObject, but takes a Dart value.
Static Methods
-
parseHTMLUnsafe(
JSAny html) → Document -
The
parseHTMLUnsafe()
static method of the Document object is used to parse a string of HTML, which may contain declarative shadow roots, in order to create a new Document instance.