XMLDocument extension type

The XMLDocument interface represents an XML document. It inherits from the generic Document and does not add any specific methods or properties to it: nevertheless, several algorithms behave differently with the two types of documents.

on
Implemented types
Available extensions

Properties

activeElement Element?
no setterinherited
adoptedStyleSheets JSArray<CSSStyleSheet>
getter/setter pairinherited
alinkColor String
getter/setter pairinherited
all HTMLAllCollection
no setterinherited
anchors HTMLCollection
no setterinherited
applets HTMLCollection
no setterinherited
baseURI String
no setterinherited
bgColor String
getter/setter pairinherited
body HTMLElement?
getter/setter pairinherited
characterSet String
no setterinherited
charset String
no setterinherited
childElementCount int
no setterinherited
childNodes NodeList
no setterinherited
children HTMLCollection
no setterinherited
compatMode String
no setterinherited
contentType String
no setterinherited
getter/setter pairinherited
currentScript HTMLOrSVGScriptElement?
no setterinherited
defaultView Window?
no setterinherited
designMode String
getter/setter pairinherited
dir String
getter/setter pairinherited
doctype DocumentType?
no setterinherited
documentElement Element?
no setterinherited
documentURI String
no setterinherited
domain String
getter/setter pairinherited
embeds HTMLCollection
no setterinherited
fgColor String
getter/setter pairinherited
firstChild Node?
no setterinherited
firstElementChild Element?
no setterinherited
fonts FontFaceSet
no setterinherited
forms HTMLCollection
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
no setterinherited
hidden bool
no setterinherited
images HTMLCollection
no setterinherited
implementation DOMImplementation
no setterinherited
inputEncoding String
no setterinherited
isConnected bool
no setterinherited
lastChild Node?
no setterinherited
lastElementChild Element?
no setterinherited
lastModified String
no setterinherited
linkColor String
getter/setter pairinherited
no setterinherited
location Location?
no setterinherited
nextSibling Node?
no setterinherited
nodeName String
no setterinherited
nodeType int
no setterinherited
nodeValue String?
getter/setter pairinherited
onabort EventHandler?
getter/setter pairinherited
onanimationcancel EventHandler?
getter/setter pairinherited
onanimationend EventHandler?
getter/setter pairinherited
onanimationiteration EventHandler?
getter/setter pairinherited
onanimationstart EventHandler?
getter/setter pairinherited
onauxclick EventHandler?
getter/setter pairinherited
onbeforeinput EventHandler?
getter/setter pairinherited
onbeforematch EventHandler?
getter/setter pairinherited
onbeforetoggle EventHandler?
getter/setter pairinherited
onblur EventHandler?
getter/setter pairinherited
oncancel EventHandler?
getter/setter pairinherited
oncanplay EventHandler?
getter/setter pairinherited
oncanplaythrough EventHandler?
getter/setter pairinherited
onchange EventHandler?
getter/setter pairinherited
onclick EventHandler?
getter/setter pairinherited
onclose EventHandler?
getter/setter pairinherited
oncontextlost EventHandler?
getter/setter pairinherited
oncontextmenu EventHandler?
getter/setter pairinherited
oncontextrestored EventHandler?
getter/setter pairinherited
oncopy EventHandler?
getter/setter pairinherited
oncuechange EventHandler?
getter/setter pairinherited
oncut EventHandler?
getter/setter pairinherited
ondblclick EventHandler?
getter/setter pairinherited
ondrag EventHandler?
getter/setter pairinherited
ondragend EventHandler?
getter/setter pairinherited
ondragenter EventHandler?
getter/setter pairinherited
ondragleave EventHandler?
getter/setter pairinherited
ondragover EventHandler?
getter/setter pairinherited
ondragstart EventHandler?
getter/setter pairinherited
ondrop EventHandler?
getter/setter pairinherited
ondurationchange EventHandler?
getter/setter pairinherited
onemptied EventHandler?
getter/setter pairinherited
onended EventHandler?
getter/setter pairinherited
onerror OnErrorEventHandler?
getter/setter pairinherited
onfocus EventHandler?
getter/setter pairinherited
onformdata EventHandler?
getter/setter pairinherited
ongotpointercapture EventHandler?
getter/setter pairinherited
oninput EventHandler?
getter/setter pairinherited
oninvalid EventHandler?
getter/setter pairinherited
onkeydown EventHandler?
getter/setter pairinherited
onkeypress EventHandler?
getter/setter pairinherited
onkeyup EventHandler?
getter/setter pairinherited
onload EventHandler?
getter/setter pairinherited
onloadeddata EventHandler?
getter/setter pairinherited
onloadedmetadata EventHandler?
getter/setter pairinherited
onloadstart EventHandler?
getter/setter pairinherited
onlostpointercapture EventHandler?
getter/setter pairinherited
onmousedown EventHandler?
getter/setter pairinherited
onmouseenter EventHandler?
getter/setter pairinherited
onmouseleave EventHandler?
getter/setter pairinherited
onmousemove EventHandler?
getter/setter pairinherited
onmouseout EventHandler?
getter/setter pairinherited
onmouseover EventHandler?
getter/setter pairinherited
onmouseup EventHandler?
getter/setter pairinherited
onpaste EventHandler?
getter/setter pairinherited
onpause EventHandler?
getter/setter pairinherited
onplay EventHandler?
getter/setter pairinherited
onplaying EventHandler?
getter/setter pairinherited
onpointercancel EventHandler?
getter/setter pairinherited
onpointerdown EventHandler?
getter/setter pairinherited
onpointerenter EventHandler?
getter/setter pairinherited
onpointerleave EventHandler?
getter/setter pairinherited
onpointermove EventHandler?
getter/setter pairinherited
onpointerout EventHandler?
getter/setter pairinherited
onpointerover EventHandler?
getter/setter pairinherited
onpointerrawupdate EventHandler?
getter/setter pairinherited
onpointerup EventHandler?
getter/setter pairinherited
onprogress EventHandler?
getter/setter pairinherited
onratechange EventHandler?
getter/setter pairinherited
onreadystatechange EventHandler?
getter/setter pairinherited
onreset EventHandler?
getter/setter pairinherited
onresize EventHandler?
getter/setter pairinherited
onscroll EventHandler?
getter/setter pairinherited
onscrollend EventHandler?
getter/setter pairinherited
onsecuritypolicyviolation EventHandler?
getter/setter pairinherited
onseeked EventHandler?
getter/setter pairinherited
onseeking EventHandler?
getter/setter pairinherited
onselect EventHandler?
getter/setter pairinherited
onselectionchange EventHandler?
getter/setter pairinherited
onselectstart EventHandler?
getter/setter pairinherited
onslotchange EventHandler?
getter/setter pairinherited
onstalled EventHandler?
getter/setter pairinherited
onsubmit EventHandler?
getter/setter pairinherited
onsuspend EventHandler?
getter/setter pairinherited
ontimeupdate EventHandler?
getter/setter pairinherited
ontoggle EventHandler?
getter/setter pairinherited
ontouchcancel EventHandler?
getter/setter pairinherited
ontouchend EventHandler?
getter/setter pairinherited
ontouchmove EventHandler?
getter/setter pairinherited
ontouchstart EventHandler?
getter/setter pairinherited
ontransitioncancel EventHandler?
getter/setter pairinherited
ontransitionend EventHandler?
getter/setter pairinherited
ontransitionrun EventHandler?
getter/setter pairinherited
ontransitionstart EventHandler?
getter/setter pairinherited
onvisibilitychange EventHandler?
getter/setter pairinherited
onvolumechange EventHandler?
getter/setter pairinherited
onwaiting EventHandler?
getter/setter pairinherited
onwebkitanimationend EventHandler?
getter/setter pairinherited
onwebkitanimationiteration EventHandler?
getter/setter pairinherited
onwebkitanimationstart EventHandler?
getter/setter pairinherited
onwebkittransitionend EventHandler?
getter/setter pairinherited
onwheel EventHandler?
getter/setter pairinherited
ownerDocument Document?
no setterinherited
parentElement Element?
no setterinherited
parentNode Node?
no setterinherited
plugins HTMLCollection
no setterinherited
previousSibling Node?
no setterinherited
readyState DocumentReadyState
no setterinherited
referrer String
no setterinherited
rootElement SVGSVGElement?
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scripts HTMLCollection
no setterinherited
scrollingElement Element?
no setterinherited
styleSheets StyleSheetList
no setterinherited
textContent String?
getter/setter pairinherited
timeline DocumentTimeline
no setterinherited
title String
getter/setter pairinherited
URL String
no setterinherited
visibilityState DocumentVisibilityState
no setterinherited
vlinkColor String
getter/setter pairinherited

Methods

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.
inherited
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.
inherited
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
captureEvents() → void
inherited
caretPositionFromPoint(num x, num y) CaretPosition?
The caretPositionFromPoint() method of the Document interface returns a CaretPosition object, containing the DOM node, along with the caret and caret's character offset within that node.
inherited
clear() → void
The Document.clear() method does nothing, but doesn't raise any error.
inherited
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.
inherited
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
convertPointFromNode(DOMPointInit point, GeometryNode from, [ConvertCoordinateOptions options]) DOMPoint
inherited
convertQuadFromNode(DOMQuadInit quad, GeometryNode from, [ConvertCoordinateOptions options]) DOMQuad
inherited
convertRectFromNode(DOMRectReadOnly rect, GeometryNode from, [ConvertCoordinateOptions options]) DOMQuad
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.
inherited
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.
inherited
createCDATASection(String data) CDATASection
createCDATASection() creates a new CDATA section node, and returns it.
inherited
createComment(String data) Comment
createComment() creates a new comment node, and returns it.
inherited
createDocumentFragment() DocumentFragment
Creates a new empty DocumentFragment into which DOM nodes can be added to build an offscreen DOM tree.
inherited
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.
inherited
createElementNS(String? namespace, String qualifiedName, [JSAny options]) Element
Creates an element with the specified namespace URI and qualified name.
inherited
createEvent(String interface) Event

Warning: Many methods used with createEvent, such as initCustomEvent, are deprecated. Use event constructors instead.

inherited
createExpression(String expression, [XPathNSResolver? resolver]) XPathExpression
This method compiles an XPathExpression which can then be used for (repeated) evaluations.
inherited
createNodeIterator(Node root, [int whatToShow, NodeFilter? filter]) NodeIterator
The Document.createNodeIterator() method returns a new NodeIterator object.
inherited
createNSResolver(Node nodeResolver) Node
Creates an XPathNSResolver which resolves namespaces with respect to the definitions in scope for a specified node.
inherited
createProcessingInstruction(String target, String data) ProcessingInstruction
createProcessingInstruction() generates a new processing instruction node and returns it.
inherited
createRange() Range
The Document.createRange() method returns a new Range object.
inherited
createTextNode(String data) Text
Creates a new Text node. This method can be used to escape HTML characters.
inherited
createTreeWalker(Node root, [int whatToShow, NodeFilter? filter]) TreeWalker
The Document.createTreeWalker() creator method returns a newly created TreeWalker object.
inherited
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 with dispatchEvent().
inherited
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).
inherited
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.
inherited
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.
inherited
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).
inherited
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.
inherited
getBoxQuads([BoxQuadOptions options]) JSArray<DOMQuad>
inherited
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.
inherited
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).
inherited
getElementsByName(String elementName) NodeList
The getElementsByName() method of the Document object returns a NodeList Collection of elements with a given name attribute in the document.
inherited
getElementsByTagName(String qualifiedName) HTMLCollection
The getElementsByTagName method of Document interface returns an HTMLCollection of elements with the given tag name.
inherited
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.
inherited
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.
inherited
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.
inherited
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.
inherited
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
isDefaultNamespace(String? namespace) bool
The isDefaultNamespace() method of the Node interface accepts a namespace URI as an argument. It returns a boolean value that is true if the namespace is the default namespace on the given node and false 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
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 (and null 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, and null if not. When multiple prefixes are possible, the first prefix is returned.
inherited
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
open([String unused1OrUrl, String nameOrUnused2, String features]) JSObject?
The Document.open() method opens a document for Document.write.
inherited
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.
inherited
queryCommandEnabled(String commandId) bool
The Document.queryCommandEnabled() method reports whether or not the specified editor command is enabled by the browser.
inherited
queryCommandIndeterm(String commandId) bool
inherited
queryCommandState(String commandId) bool
The queryCommandState() method will tell you if the current selection has a certain Document.execCommand command applied.
inherited
queryCommandSupported(String commandId) bool
The Document.queryCommandSupported() method reports whether or not the specified editor command is supported by the browser.
inherited
queryCommandValue(String commandId) String
inherited
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.
inherited
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.
inherited
releaseEvents() → void
inherited
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 a Document with a specified new set of children.
inherited
toString() String
A string representation of this object.
inherited
write(String 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 if document.open() had been called. In yet more cases, the method is simply ignored, or throws an exception. Users agents are explicitly allowed to avoid executing script 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.

inherited
writeln(String 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 if document.open() had been called. In yet more cases, the method is simply ignored, or throws an exception. Users agents are explicitly allowed to avoid executing script 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.

inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited