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
activeElementread-only property of the Document interface returns the Element within the DOM that currently has focus.no setter -
adoptedStyleSheets
↔ JSArray<
CSSStyleSheet> -
The
adoptedStyleSheetsproperty 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
mousedownandmouseupevents.getter/setter pair - all → HTMLAllCollection
-
The Document interface's read-only
allproperty returns an HTMLAllCollection rooted at the document node.no setter - anchors → HTMLCollection
-
The
anchorsread-only property of the Document interface returns a list of all of the anchors in the document.no setter - applets → HTMLCollection
-
The
appletsproperty 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 - asElement → Element
-
Available on Node, provided by the NodeExtension extension
no setter - asElementChecked → Element?
-
Available on Node?, provided by the NodeNullableExtension extension
no setter - asHTMLElement → HTMLElement
-
Available on Node, provided by the NodeExtension extension
no setter - asHTMLElementChecked → HTMLElement?
-
Available on Node?, provided by the NodeNullableExtension extension
no setter - asString → String
-
Available on JSAny, provided by the JSAnyExtension extension
no setter - asString → String?
-
Available on JSAny?, provided by the JSAnyNullableExtension extension
no setter - baseURI → String
-
The read-only
baseURIproperty of the Node interface returns the absolute base URL of the document containing the node.no setterinherited - bgColor ↔ String
-
The deprecated
bgColorproperty gets or sets the background color of the current document.getter/setter pair - body ↔ HTMLElement?
-
The
Document.bodyproperty represents thebodyorframesetnode of the current document, ornullif no such element exists.getter/setter pair - characterSet → String
-
The
Document.characterSetread-only property returns the character encoding of the document that it's currently rendered with.no setter - childElementCount → int
-
The
Document.childElementCountread-only property returns the number of child elements of the document.no setter - childNodes → NodeList
-
The read-only
childNodesproperty 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
childrenproperty 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.compatModeread-only property indicates whether the document is rendered in Quirks mode or Standards mode.no setter - contentType → String
-
The
Document.contentTyperead-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
cookielets 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.currentScriptproperty returns thescriptelement whose script is currently being processed and isn't a JavaScript module. (For modules useimport.metainstead.)no setter - defaultView → Window?
-
In browsers,
document.defaultViewreturns the Window object associated with , ornullif none is available.no setter - designMode ↔ String
-
document.designModecontrols 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.dirproperty 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
doctyperead-only property of the Document interface is a DocumentType object representing the the associated with the current document.no setter - documentElement → Element?
-
The
documentElementread-only property of the Document interface returns the Element that is the root element of the document (for example, thehtmlelement for HTML documents).no setter - documentURI → String
-
The
documentURIread-only property of the Document interface returns the document location as a string.no setter - domain ↔ String
-
The
domainproperty 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
embedsread-only property of the Document interface returns a list of the embeddedembedelements within the current document.no setter -
entries
→ Iterable<
MapEntry< String, dynamic> > -
Available on JSObject, provided by the JSObjectExtension extension
no setter - fgColor ↔ String
-
fgColorgets/sets the foreground color, or text color, of the current document.getter/setter pair - firstChild → Node?
-
The read-only
firstChildproperty of the Node interface returns the node's first child in the tree, ornullif the node has no children.no setterinherited - firstElementChild → Element?
-
The
Document.firstElementChildread-only property returns the document's first child Element, ornullif there are no child elements.no setter - fonts → FontFaceSet
-
The
fontsproperty of the Document interface returns the FontFaceSet interface of the document.no setter - forms → HTMLCollection
-
The
formsread-only property of the Document interface returns an HTMLCollection listing all theformelements contained in the document.no setter - fullscreen → bool
-
The obsolete Document interface's
fullscreenread-only property reports whether or not the document is currently displaying content in fullscreen mode.no setter - fullscreenElement → Element?
-
The
Document.fullscreenElementread-only property returns the Element that is currently being presented in fullscreen mode in this document, ornullif fullscreen mode is not currently in use.no setter - fullscreenEnabled → bool
-
The read-only
fullscreenEnabledproperty 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
headread-only property of the Document interface returns theheadelement of the current document.no setter -
The
Document.hiddenread-only property returns a Boolean value indicating if the page is considered hidden or not.no setter - images → HTMLCollection
-
The
imagesread-only property of the Document interface returns a collection of the images in the current HTML document.no setter - implementation → DOMImplementation
-
The
Document.implementationproperty returns a DOMImplementation object associated with the current document.no setter - isConnected → bool
-
The read-only
isConnectedproperty 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 - isElement → bool
-
Available on JSObject?, provided by the JSObjectWebExtension extension
no setter - isHTMLElement → bool
-
Available on JSObject?, provided by the JSObjectWebExtension extension
no setter - isNode → bool
-
Available on JSObject?, provided by the JSObjectWebExtension 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.thisno 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 -
keys
→ Iterable<
String> -
Available on JSObject, provided by the JSObjectExtension extension
no setter - lastChild → Node?
-
The read-only
lastChildproperty of the Node interface returns the last child of the node, ornullif there are no child nodes.no setterinherited - lastElementChild → Element?
-
The
Document.lastElementChildread-only property returns the document's last child Element, ornullif there are no child elements.no setter - lastModified → String
-
The
lastModifiedproperty 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.linkColorproperty gets/sets the color of links within the document.getter/setter pair - links → HTMLCollection
-
The
linksread-only property of the Document interface returns a collection of allareaelements andaelements in a document with a value for the href attribute.no setter - location → Location?
-
The
Document.locationread-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
nextSiblingproperty of the Node interface returns the node immediately following the specified one in their parent's Node.childNodes, or returnsnullif the specified node is the last child in the parent element.no setterinherited - nodeName → String
-
The read-only
nodeNameproperty of Node returns the name of the current node as a string.no setterinherited - nodeType → int
-
The read-only
nodeTypeproperty 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
nodeValueproperty 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.thisno 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 ↔ EventHandler?
-
getter/setter pair
-
onLoad
→ Stream<
Event> -
Available on Document, provided by the DocumentCustomEvents extension
no setter - 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 ↔ EventHandler?
-
getter/setter pair
-
onVisibilityChange
→ Stream<
Event> -
Available on Document, provided by the DocumentCustomEvents extension
no setter - onvolumechange ↔ EventHandler?
-
getter/setter pair
- onwaiting ↔ EventHandler?
-
getter/setter pair
- onwheel ↔ EventHandler?
-
getter/setter pair
- ownerDocument → Document?
-
The read-only
ownerDocumentproperty of the Node interface returns the top-level document object of the node.no setterinherited - parentElement → Element?
-
The read-only
parentElementproperty of Node interface returns the DOM node's parent Element, ornullif the node either has no parent, or its parent isn't a DOM Element.no setterinherited - parentNode → Node?
-
The read-only
parentNodeproperty of the Node interface returns the parent of the specified node in the DOM tree.no setterinherited - pictureInPictureElement → Element?
-
The read-only
pictureInPictureElementproperty of the Document interface returns the Element that is currently being presented in picture-in-picture mode in this document, ornullif picture-in-picture mode is not currently in use.no setter - pictureInPictureEnabled → bool
-
The read-only
pictureInPictureEnabledproperty of the Document interface indicates whether or not picture-in-picture mode is available.no setter - plugins → HTMLCollection
-
The
pluginsread-only property of the Document interface returns an HTMLCollection object containing one or more HTMLEmbedElements representing theembedelements in the current document.no setter - pointerLockElement → Element?
-
The
pointerLockElementread-only property of the Document interface provides the element set as the target for mouse events while the pointer is locked. It isnullif lock is pending, pointer is unlocked, or the target is in another document.no setter - previousSibling → Node?
-
The read-only
previousSiblingproperty of the Node interface returns the node immediately preceding the specified one in its parent's Node.childNodes list, ornullif the specified node is the first in that list.no setterinherited - readyState → DocumentReadyState
-
The
Document.readyStateproperty describes the loading state of the document. When the value of this property changes, aDocument.readystatechange_eventevent fires on the document object.no setter - referrer → String
-
The
Document.referrerproperty returns the URI of the page that linked to this page.no setter - rootElement → SVGSVGElement?
-
Document.rootElementreturns 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
scriptsproperty of the Document interface returns a list of thescriptelements in the document. The returned object is an HTMLCollection.no setter - scrollingElement → Element?
-
The
scrollingElementread-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
styleSheetsread-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
textContentproperty of the Node interface represents the text content of the node and its descendants.getter/setter pairinherited - timeline → DocumentTimeline
-
The
timelinereadonly 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.titleproperty 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
URLread-only property of the Document interface returns the document location as a string.no setter - visibilityState → DocumentVisibilityState
-
The
Document.visibilityStateread-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.vlinkColorproperty 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 ofin 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 ofin 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 -
appendNodes(
Iterable< Node> nodes) → void -
Available on Node, provided by the NodeExtension extension
-
as<
T extends JSObject> () → T? -
Available on JSObject, provided by the JSObjectExtension extension
-
callMethod<
R extends JSAny?> (JSAny method, [JSAny? arg1, JSAny? arg2, JSAny? arg3, JSAny? arg4]) → R -
Available on JSObject, provided by the JSObjectUnsafeUtilExtension extension
Callsmethodon 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
Callsmethodon 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 aCaretPositionobject, containing the DOM node, along with the caret and caret's character offset within that node. -
clear(
) → void -
Available on Node, provided by the NodeExtension extension
-
clear(
) → void -
The
Document.clear()method does nothing, but doesn't raise any error. -
clearNodes(
) → List< Node> -
Available on Node, provided by the NodeExtension extension
-
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 newNodeIteratorobject. -
createNSResolver(
Node nodeResolver) → Node -
Creates an
XPathNSResolverwhich 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 JSON-like value to the Dart equivalent if possible. -
delete(
JSAny property) → JSBoolean -
Available on JSObject, provided by the JSObjectUnsafeUtilExtension extension
Deletes the property with keypropertyfrom 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 ofin 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 ofin 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
execCommandmethod implements multiple different commands. Some of them provide access to the clipboard, while others are for editing form inputs,contenteditableelements 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 ofin JavaScript.this**any -
get(
String key) → Object? -
Available on JSObject, provided by the JSObjectExtension extension
-
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
getElementsByClassNamemethod 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 givennameattribute in the document. -
getElementsByTagName(
String qualifiedName) → HTMLCollection -
The
getElementsByTagNamemethod 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 keypropertyof 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 ofin JavaScript.this>any -
greaterThanOrEqualTo(
JSAny? any) → JSBoolean -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result ofin 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 aPromisethat 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 aPromisethat 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 -
insertNode(
int index, Node node) → Node -
Available on Node, provided by the NodeExtension extension
-
instanceof(
JSFunction constructor) → bool -
Available on JSAny?, provided by the JSAnyUtilityExtension extension
Whether thisJSAny?is aninstanceofconstructor. -
instanceOfString(
String constructorName) → bool -
Available on JSAny?, provided by the JSAnyUtilityExtension extension
Whether thisJSAny?is aninstanceofthe 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 istrueif the namespace is the default namespace on the given node andfalseif 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 ofin JavaScript.this<any -
lessThanOrEqualTo(
JSAny? any) → JSBoolean -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result ofin 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 (andnullif 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, andnullif 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 ofin JavaScript.this%any -
multiply(
JSAny? any) → JSAny -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result ofin 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 ofin 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 ofin 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. -
put(
Object key, Object? value) → void -
Available on JSObject, provided by the JSObjectExtension extension
-
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,nullis 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. -
querySelectorAllNonTyped(
String selectors) → List< Element> -
Available on Document, provided by the DocumentExtension extension
-
querySelectorAllTyped<
T extends Element> (String selectors, Web< T> webType) → List<T> -
Available on Document, provided by the DocumentExtension extension
-
querySelectorNonTyped(
String selectors) → Element? -
Available on Document, provided by the DocumentExtension extension
-
querySelectorTyped<
T extends Element> (String selectors, Web< T> webType) → T? -
Available on Document, provided by the DocumentExtension extension
-
releaseEvents(
) → void -
remove(
) → void -
Available on Node, provided by the NodeExtension extension
-
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 -
removeNodeAt(
int index) → Node? -
Available on Node, provided by the NodeExtension extension
-
removeNodes(
Iterable< Node> nodes) → void -
Available on Node, provided by the NodeExtension extension
-
removeNodeWhere(
bool test(Node node)) → void -
Available on Node, provided by the NodeExtension extension
-
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 aDocumentwith 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. -
select(
String selectors) → Element? -
Available on Document, provided by the DocumentExtension extension
-
selectAll(
String selectors) → List< Element> -
Available on Document, provided by the DocumentExtension extension
-
selectAllTyped<
T extends Element> (String selectors, Web< T> webType) → List<T> -
Available on Document, provided by the DocumentExtension extension
-
selectTyped<
T extends Element> (String selectors, Web< T> webType) → T? -
Available on Document, provided by the DocumentExtension extension
-
setProperty(
JSAny property, JSAny? value) → void -
Available on JSObject, provided by the JSObjectUnsafeUtilExtension extension
Write thevalueof property keypropertyof 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 ofin JavaScript.this===any -
strictNotEquals(
JSAny? any) → JSBoolean -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result ofin JavaScript.this!==any -
subtract(
JSAny? any) → JSAny -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result ofin JavaScript.this-any -
toMap(
) → Map< String, dynamic> -
Available on JSObject, provided by the JSObjectExtension extension
-
toString(
) → String -
A string representation of this object.
inherited
-
typeofEquals(
String typeString) → bool -
Available on JSAny?, provided by the JSAnyUtilityExtension extension
Whether the result oftypeofon thisJSAny?istypeString. -
unsignedRightShift(
JSAny? any) → JSNumber -
Available on JSAny?, provided by the JSAnyOperatorExtension extension
The result ofin 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 executingscriptelements 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 executingscriptelements 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 keypropertyof this JSObject, but takes a Dart value. -
operator []=(
String property, JSAny? value) → void -
Available on JSObject, provided by the JSObjectUnsafeUtilExtension extension
Shorthand helper for setProperty to write thevalueof the property keypropertyof 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.