---
url: "https://dom.spec.whatwg.org/"
titulek: "DOM Standard"
h1: "DOM"
popis: ""
jazyk: "en"
kanonicka: ""
drobecky: []
zdroj: "live"
wayback_snapshot: ""
stazeno: "2026-09-14 00:29:50"
znaku: 520284
slov: 59376
kodovani: "utf-8"
sha256: "bfde1117739cf93463ed17ba0af7d663abf098fbd126f2bcf92e93ce7d787487"
---
DOM Living Standard — Last Updated 25 August 2026
Participate:
[GitHub whatwg/dom](https://github.com/whatwg/dom) ([new issue](https://github.com/whatwg/dom/issues/new/choose), [open issues](https://github.com/whatwg/dom/issues))
[Chat on Matrix](https://whatwg.org/chat)
Commits:
[GitHub whatwg/dom/commits](https://github.com/whatwg/dom/commits) [Snapshot as of this commit](/commit-snapshots/a2331a45360129e8645ef7e0a04740241b6e3726/)
Tests:
[web-platform-tests dom/](https://github.com/web-platform-tests/wpt/tree/master/dom) ([ongoing work](https://github.com/web-platform-tests/wpt/labels/dom))
Translations (non-normative):
[日本語](https://triple-underscore.github.io/DOM4-ja.html) [简体中文](https://htmlspecs.com/dom/) [한국어](https://ko.htmlspecs.com/dom/)
## Abstract
DOM defines a platform-neutral model for events, aborting activities, and node trees.
## 1. Infrastructure
This specification depends on the Infra Standard. [INFRA]
Some of the terms used in this specification are defined in Encoding,
Selectors, Trusted Types, Web IDL, XML,
Namespaces in XML, and Associating Style Sheets with XML documents.
[ENCODING] [SELECTORS4] [TRUSTED-TYPES] [WEBIDL] [XML] [XML-NAMES] [XML-STYLESHEET]
When extensions are needed, the DOM Standard can be updated accordingly, or a new standard
can be written that hooks into the provided extensibility hooks for
applicable specifications.
### 1.1. Trees
A tree is a finite hierarchical tree structure. In
tree order is preorder, depth-first traversal of a
tree.
An object that
participates
in a tree has a parent, which is either
null or an object, and has
children, which is an
[ordered set](https://infra.spec.whatwg.org/#ordered-set) of objects. An object A whose parent is object
B is a child of B.
The root of an object is itself, if its
parent is null, or else it is the root of its
parent. The root of a tree is any object
participating in that tree whose parent is null.
An object A is called a
descendant of an object B, if
either A is a child of B or A is a
child of an object C that is a descendant of
B.
An inclusive descendant is an
object or one of its descendants.
An object A is called an ancestor
of an object B if and only if B is a descendant of
A.
An inclusive ancestor is an object
or one of its ancestors.
An object A is called a sibling of
an object B, if and only if B and A share the same non-null
parent.
An inclusive sibling is an object or
one of its siblings.
An object A is preceding an
object B if A and B are in the same tree and A
comes before B in tree order.
An object A is following an
object B if A and B are in the same tree and A
comes after B in tree order.
The first child of an object is its first
child or null if it has no children.
The last child of an object is its last
child or null if it has no children.
The previous sibling of an object is
its first preceding sibling or null if it has no
preceding sibling.
The next sibling of an object is its
first following sibling or null if it has no following sibling.
The index of an object is its number of
preceding siblings, or 0 if it has none.
### 1.2. Ordered sets
The ordered set parser takes a string
input and then runs these steps:
1. Let inputTokens be the result of
[splitting input on ASCII whitespace](https://infra.spec.whatwg.org/#split-on-ascii-whitespace).
2. Let tokens be a new [ordered set](https://infra.spec.whatwg.org/#ordered-set).
3. [For each](https://infra.spec.whatwg.org/#list-iterate) token of inputTokens: [append](https://infra.spec.whatwg.org/#set-append) token to tokens.
4. Return tokens .
The ordered set serializer takes a
set and returns the [concatenation](https://infra.spec.whatwg.org/#string-concatenate) of set using U+0020 SPACE.
### 1.3. Selectors
To scope-match a selectors string given a string selectors against a
node node:
1. Let selector be the result of [parse a selector](https://drafts.csswg.org/selectors-4/#parse-a-selector) selectors.
[SELECTORS4]
2. If selector is failure, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[SyntaxError](https://webidl.spec.whatwg.org/#syntaxerror)`"
`[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
3. Return the result of [match a selector against a tree](https://drafts.csswg.org/selectors-4/#match-a-selector-against-a-tree) with selector and
node’s root using [scoping root](https://drafts.csswg.org/selectors-4/#scoping-root) node. [SELECTORS4].
Support for namespaces within selectors is not planned and will not be added.
### 1.4. Name validation
A [string](https://infra.spec.whatwg.org/#string) is a valid namespace prefix if its [length](https://infra.spec.whatwg.org/#string-length) is at least 1 and it
does not contain [ASCII whitespace](https://infra.spec.whatwg.org/#ascii-whitespace), U+0000 NULL, U+002F (/), or U+003E (>).
A [string](https://infra.spec.whatwg.org/#string) is a valid attribute local name if its [length](https://infra.spec.whatwg.org/#string-length) is at least 1
and it does not contain [ASCII whitespace](https://infra.spec.whatwg.org/#ascii-whitespace), U+0000 NULL, U+002F (/), U+003D (=), or U+003E (>).
A [string](https://infra.spec.whatwg.org/#string) name is a valid element local name if the following steps return true:
1. If name’s [length](https://infra.spec.whatwg.org/#string-length) is 0, then return false.
2. If name’s 0th [code point](https://infra.spec.whatwg.org/#code-point) is an [ASCII alpha](https://infra.spec.whatwg.org/#ascii-alpha):
1. If name contains [ASCII whitespace](https://infra.spec.whatwg.org/#ascii-whitespace), U+0000 NULL, U+002F (/), or U+003E (>), then
return false.
2. Return true.
3. If name’s 0th [code point](https://infra.spec.whatwg.org/#code-point) is not U+003A (:), U+005F (_), or in the range U+0080
to U+10FFFF, inclusive, then return false.
4. If name’s subsequent [code points](https://infra.spec.whatwg.org/#code-point), if any, are not [ASCII alphas](https://infra.spec.whatwg.org/#ascii-alpha), [ASCII digits](https://infra.spec.whatwg.org/#ascii-digit),
U+002D (-), U+002E (.), U+003A (:), U+005F (_), or in the range U+0080 to U+10FFFF, inclusive, then
return false.
5. Return true.
This concept is used to validate element local names, when
constructed by DOM APIs. The intention is to allow any name that is possible to construct using the
HTML parser (the branch where the first [code point](https://infra.spec.whatwg.org/#code-point) is an [ASCII alpha](https://infra.spec.whatwg.org/#ascii-alpha)), plus some additional
possibilities. For those additional possibilities, the ASCII range is restricted for historical
reasons, but beyond ASCII anything is allowed.
The following JavaScript-compatible regular expression is an implementation of
valid element local name:
```
/^(?:[A-Za-z][^\0\t\n\f\r\u0020/>]*|[:_\u0080-\u{10FFFF}][A-Za-z0-9-.:_\u0080-\u{10FFFF}]*)$/u
```
A [string](https://infra.spec.whatwg.org/#string) is a valid doctype name if it does not contain [ASCII whitespace](https://infra.spec.whatwg.org/#ascii-whitespace),
U+0000 NULL, or U+003E (>).
The empty string is a valid doctype name.
To validate and extract a namespace and qualifiedName, given a
context:
1. If namespace is the empty string, then set it to null.
2. Let prefix be null.
3. Let localName be qualifiedName.
4. If qualifiedName contains a U+003A (:):
1. Set prefix to the part of qualifiedName before the first U+003A (:).
2. Set localName to the part of qualifiedName after the first U+003A (:).
3. If prefix is not a valid namespace prefix, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an
"`[InvalidCharacterError](https://webidl.spec.whatwg.org/#invalidcharactererror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
5. [Assert](https://infra.spec.whatwg.org/#assert): prefix is either null or a valid namespace prefix.
6. If context is "`attribute`" and localName is not a
valid attribute local name, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an "`[InvalidCharacterError](https://webidl.spec.whatwg.org/#invalidcharactererror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
7. If context is "`element`" and localName is not a
valid element local name, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an "`[InvalidCharacterError](https://webidl.spec.whatwg.org/#invalidcharactererror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
8. If prefix is non-null and namespace is null, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a
"`[NamespaceError](https://webidl.spec.whatwg.org/#namespaceerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
9. If prefix is "`xml`" and namespace is not the
[XML namespace](https://infra.spec.whatwg.org/#xml-namespace), then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NamespaceError](https://webidl.spec.whatwg.org/#namespaceerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
10. If either qualifiedName or prefix is "`xmlns`" and
namespace is not the [XMLNS namespace](https://infra.spec.whatwg.org/#xmlns-namespace), then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a
"`[NamespaceError](https://webidl.spec.whatwg.org/#namespaceerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
11. If namespace is the [XMLNS namespace](https://infra.spec.whatwg.org/#xmlns-namespace) and neither qualifiedName
nor prefix is "`xmlns`", then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NamespaceError](https://webidl.spec.whatwg.org/#namespaceerror)`"
`[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
12. Return (namespace, prefix, localName).
Various APIs in this specification used to validate namespace prefixes, attribute local names,
element local names, and doctype names more strictly. This was done in a way that aligned with
various XML-related specifications. (Although not all rules from the those specifications were
enforced.)
This was found to be annoying for web developers, especially since it meant there were some
names that could be created by the HTML parser, but not by DOM APIs. So, the validations have been
loosened to just those described above.
## 2. Events
### 2.1. Introduction to "DOM Events"
Throughout the web platform events are dispatched to objects to signal an
occurrence, such as network activity or user interaction. These objects implement the
`EventTarget` interface and can therefore add event listeners to observe
events by calling `addEventListener()`:
```
obj.addEventListener("load", imgFetched) function imgFetched(ev) { // great success
…
}
```
Event listeners can be removed
by utilizing the
`removeEventListener()`
method, passing the same arguments.
Alternatively, event listeners can be removed by passing an `AbortSignal` to
`addEventListener()` and calling `abort()` on the controller
owning the signal.
Events are objects too and implement the
`Event` interface (or a derived interface). In the example above
ev is the event. ev is
passed as an argument to the
event listener’s callback
(typically a JavaScript Function as shown above).
Event listeners key off the
event’s
`type` attribute value
("`load`" in the above example). The
event’s
`target` attribute value returns the
object to which the event was
dispatched
(obj above).
Although events are typically dispatched by the user agent
as the result of user interaction or the completion of some task, applications can dispatch events themselves by using what are commonly known as synthetic events:
```
// add an appropriate event listener
obj.addEventListener("cat", function(e) { process(e.detail) }) // create and dispatch the event var event = new CustomEvent("cat", {"detail":{"hazcheeseburger":true}})
obj.dispatchEvent(event)
```
Apart from signaling, events are
sometimes also used to let an application control what happens next in an
operation. For instance as part of form submission an
event whose
`type` attribute value is
"`submit`" is
dispatched. If this
event’s
`preventDefault()` method is
invoked, form submission will be terminated. Applications who wish to make
use of this functionality through events dispatched by the application
(synthetic events) can make use of the return value of the
`dispatchEvent()` method:
```
if(obj.dispatchEvent(event)) { // event was not canceled, time for some magic
…
}
```
When an event is dispatched to an object that participates in a tree
(e.g., an element), it can reach event listeners on that object’s
ancestors too. Effectively, all the object’s inclusive ancestor event listeners whose capture is true are invoked, in
tree order. And then, if event’s `bubbles` is true, all the object’s
inclusive ancestor event listeners whose capture is false
are invoked, now in reverse tree order.
Let’s look at an example of how events work in a tree:
```
Boring example Hello world!
```
The `debug` function will be invoked twice. Each time the event’s
`target` attribute value will be the `span` element. The first time
`currentTarget` attribute’s value will be the document, the second time the
`body` element. `eventPhase` attribute’s value switches from
`CAPTURING_PHASE` to `BUBBLING_PHASE`. If an event listener was registered
for the `span` element, `eventPhase` attribute’s value would have
been `AT_TARGET`.
### 2.2. Interface `Event`
```
[Exposed=*]
interface Event {
constructor(DOMString type, optional EventInit eventInitDict = {});
readonly attribute DOMString type;
readonly attribute EventTarget? target;
readonly attribute EventTarget? srcElement; // legacy
readonly attribute EventTarget? currentTarget;
sequence composedPath();
const unsigned short NONE = 0;
const unsigned short CAPTURING_PHASE = 1;
const unsigned short AT_TARGET = 2;
const unsigned short BUBBLING_PHASE = 3;
readonly attribute unsigned short eventPhase;
undefined stopPropagation();
attribute boolean cancelBubble; // legacy alias of .stopPropagation()
undefined stopImmediatePropagation();
readonly attribute boolean bubbles;
readonly attribute boolean cancelable;
attribute boolean returnValue; // legacy
undefined preventDefault();
readonly attribute boolean defaultPrevented;
readonly attribute boolean composed;
[LegacyUnforgeable] readonly attribute boolean isTrusted;
readonly attribute DOMHighResTimeStamp timeStamp;
undefined initEvent(DOMString type, optional boolean bubbles = false, optional boolean cancelable = false); // legacy
};
dictionary EventInit {
boolean bubbles = false;
boolean cancelable = false;
boolean composed = false;
};
```
An `Event` object is simply named an event. It allows for
signaling that something has occurred, e.g., that an image has completed downloading.
A potential event target is null or an `EventTarget` object.
An event has an associated target (a
potential event target). Unless stated otherwise it is null.
An event has an associated relatedTarget (a
potential event target). Unless stated otherwise it is null.
Other specifications use relatedTarget to define a
`relatedTarget` attribute. [UIEVENTS]
An event has an associated touch target list (a
[list](https://infra.spec.whatwg.org/#list) of zero or more potential event targets). Unless stated otherwise it is the
empty list.
The touch target list is for the exclusive use of defining the
`[TouchEvent](https://w3c.github.io/touch-events/#idl-def-touchevent)` interface and related interfaces. [TOUCH-EVENTS]
An event has an associated path. A path is a
[list](https://infra.spec.whatwg.org/#list) of event path items. An event path item is a [struct](https://infra.spec.whatwg.org/#struct)
consisting of an invocation target
(an `EventTarget` object), an
invocation-target-in-shadow-tree
(a boolean), a
shadow-adjusted target (a
potential event target), a
relatedTarget (a
potential event target), a
touch target list (a
[list](https://infra.spec.whatwg.org/#list) of potential event targets), a
root-of-closed-tree (a boolean),
and a slot-in-closed-tree (a
boolean). A path is initially the empty list.
`event = new Event(type [, eventInitDict])` Returns a new event whose
`type` attribute value is set to
type. The eventInitDict argument
allows for setting the `bubbles` and
`cancelable` attributes via object
members of the same name.
`event . `type`` Returns the type of event, e.g.
"`click`", "`hashchange`", or
"`submit`".
`event . `target`` Returns the object to which event is dispatched (its
target).
`event . `currentTarget`` Returns the object whose event listener’s callback is currently being
invoked.
`event . `composedPath()`` Returns the invocation target objects of event’s
path (objects on which listeners will be invoked), except for any
nodes in shadow trees of which the shadow root’s
mode is "`closed`" that are not reachable from event’s
`currentTarget`.
`event . `eventPhase`` Returns the event’s phase, which is one of `NONE`,
`CAPTURING_PHASE`,
`AT_TARGET`, and
`BUBBLING_PHASE`.
`event . stopPropagation()` When dispatched in a tree, invoking this method prevents
event from reaching any objects other than the current object.
`event . stopImmediatePropagation()` Invoking this method prevents event from reaching
any registered event listeners after the current one finishes running and, when
dispatched in a tree, also prevents event from reaching any
other objects.
`event . `bubbles`` Returns true or false depending on how event was initialized. True if
event goes through its target’s ancestors in reverse
tree order; otherwise false.
`event . `cancelable`` Returns true or false depending on how event was initialized. Its return
value does not always carry meaning, but true can indicate that part of the operation
during which event was dispatched, can be canceled by invoking the
`preventDefault()` method.
`event . preventDefault()` If invoked when the `cancelable` attribute value is true, and while executing a
listener for the event with `passive` set to false, signals to
the operation that caused event to be dispatched that it needs to be canceled.
`event . `defaultPrevented`` Returns true if `preventDefault()` was invoked successfully to indicate cancelation;
otherwise false.
`event . `composed`` Returns true or false depending on how event was initialized. True if
event invokes listeners past a `ShadowRoot` node that is the
root of its target; otherwise false.
`event . `isTrusted`` Returns true if event was
dispatched by the user agent, and
false otherwise.
`event . `timeStamp`` Returns the event’s timestamp as the number of milliseconds measured relative to
the occurrence.
The `type` attribute must return the value it was
initialized to. When an event is created the attribute must be initialized to the empty
string.
The `target` getter steps are to return [this](https://webidl.spec.whatwg.org/#this)’s
target.
The `srcElement` getter steps are to return
[this](https://webidl.spec.whatwg.org/#this)’s target.
The `currentTarget` attribute must return the value it
was initialized to. When an event is created the attribute must be initialized to null.
The `composedPath()` method steps are:
1. Let composedPath be an empty [list](https://infra.spec.whatwg.org/#list).
2. Let path be [this](https://webidl.spec.whatwg.org/#this)’s path.
3. If path [is empty](https://infra.spec.whatwg.org/#list-is-empty), then return composedPath.
4. Let currentTarget be [this](https://webidl.spec.whatwg.org/#this)’s `currentTarget` attribute value.
5. [Assert](https://infra.spec.whatwg.org/#assert): currentTarget is an `EventTarget` object.
6. [Append](https://infra.spec.whatwg.org/#list-append) currentTarget to composedPath.
7. Let currentTargetIndex be 0.
8. Let currentTargetHiddenSubtreeLevel be 0.
9. Let index be path’s [size](https://infra.spec.whatwg.org/#list-size) − 1.
10. While index is greater than or equal to 0:
1. If path[index]'s root-of-closed-tree is
true, then increase currentTargetHiddenSubtreeLevel by 1.
2. If path[index]'s invocation target is
currentTarget, then set currentTargetIndex to index and
[break](https://infra.spec.whatwg.org/#iteration-break).
3. If path[index]'s slot-in-closed-tree is
true, then decrease currentTargetHiddenSubtreeLevel by 1.
4. Decrease index by 1.
11. Let currentHiddenLevel and maxHiddenLevel be
currentTargetHiddenSubtreeLevel.
12. Set index to currentTargetIndex − 1.
13. While index is greater than or equal to 0:
1. If path[index]'s root-of-closed-tree is
true, then increase currentHiddenLevel by 1.
2. If currentHiddenLevel is less than or equal to maxHiddenLevel, then
[prepend](https://infra.spec.whatwg.org/#list-prepend) path[index]'s
invocation target to composedPath.
3. If path[index]'s slot-in-closed-tree is
true:
1. Decrease currentHiddenLevel by 1.
2. If currentHiddenLevel is less than maxHiddenLevel, then set
maxHiddenLevel to currentHiddenLevel.
4. Decrease index by 1.
14. Set currentHiddenLevel and maxHiddenLevel to
currentTargetHiddenSubtreeLevel.
15. Set index to currentTargetIndex + 1.
16. While index is less than path’s [size](https://infra.spec.whatwg.org/#list-size):
1. If path[index]'s slot-in-closed-tree is
true, then increase currentHiddenLevel by 1.
2. If currentHiddenLevel is less than or equal to maxHiddenLevel, then
[append](https://infra.spec.whatwg.org/#list-append) path[index]'s
invocation target to composedPath.
3. If path[index]'s root-of-closed-tree is
true:
1. Decrease currentHiddenLevel by 1.
2. If currentHiddenLevel is less than maxHiddenLevel, then set
maxHiddenLevel to currentHiddenLevel.
4. Increase index by 1.
17. Return composedPath.
The `eventPhase` attribute must return the value it was
initialized to, which must be one of the following:
`NONE` (numeric value 0)
Events not currently
dispatched are in this phase.
`CAPTURING_PHASE` (numeric value 1)
When an event is dispatched to an object that participates in a
tree it will be in this phase before it reaches its target.
`AT_TARGET` (numeric value 2)
When an event is dispatched it will be in this phase on its
target.
`BUBBLING_PHASE` (numeric value 3)
When an event is dispatched to an object that participates in a
tree it will be in this phase after it reaches its target.
Initially the attribute must be initialized to `NONE`.
---
Each event has the following associated flags that are all initially unset:
- stop propagation flag
- stop immediate propagation flag
- canceled flag
- in passive listener flag
- composed flag
- initialized flag
- dispatch flag
The `stopPropagation()` method steps are to set
[this](https://webidl.spec.whatwg.org/#this)’s stop propagation flag.
The `cancelBubble` getter steps are to return true if
[this](https://webidl.spec.whatwg.org/#this)’s stop propagation flag is set; otherwise false.
The `cancelBubble` setter steps are to set [this](https://webidl.spec.whatwg.org/#this)’s stop propagation flag if
the given value is true; otherwise do nothing.
The `stopImmediatePropagation()` method steps are to set
[this](https://webidl.spec.whatwg.org/#this)’s stop propagation flag and [this](https://webidl.spec.whatwg.org/#this)’s
stop immediate propagation flag.
The `bubbles` and
`cancelable` attributes must return the values they were
initialized to.
To set the canceled flag, given an event event, if
event’s `cancelable` attribute value is true and event’s
in passive listener flag is unset, then set event’s canceled flag, and do
nothing otherwise.
The `returnValue` getter steps are to return false if
[this](https://webidl.spec.whatwg.org/#this)’s canceled flag is set; otherwise true.
The `returnValue` setter steps are to set the canceled flag with [this](https://webidl.spec.whatwg.org/#this) if
the given value is false; otherwise do nothing.
The `preventDefault()` method steps are to
set the canceled flag with [this](https://webidl.spec.whatwg.org/#this).
There are scenarios where invoking `preventDefault()` has no
effect. User agents are encouraged to log the precise cause in a developer console, to aid
debugging.
The `defaultPrevented` getter steps are to return true
if [this](https://webidl.spec.whatwg.org/#this)’s canceled flag is set; otherwise false.
The `composed` getter steps are to return true if
[this](https://webidl.spec.whatwg.org/#this)’s composed flag is set; otherwise false.
---
The `isTrusted` attribute must return the value it was
initialized to. When an event is created the attribute must be initialized to false.
`isTrusted` is a convenience that indicates whether an
event is dispatched by the user agent (as opposed to using
`dispatchEvent()`). The sole legacy exception is `[click()](https://html.spec.whatwg.org/multipage/interaction.html#dom-click)`, which causes
the user agent to dispatch an event whose `isTrusted` attribute is initialized to
false.
The `timeStamp` attribute must return the value it was
initialized to.
---
To initialize an event, with
type, bubbles, and cancelable, run these steps:
1. Set event’s initialized flag.
2. Unset event’s stop propagation flag,
stop immediate propagation flag, and canceled flag.
3. Set event’s `isTrusted` attribute to false.
4. Set event’s target to null.
5. Set event’s `type` attribute to type.
6. Set event’s `bubbles` attribute to bubbles.
7. Set event’s `cancelable` attribute to cancelable.
The
`initEvent(type, bubbles, cancelable)`
method steps are:
1. If [this](https://webidl.spec.whatwg.org/#this)’s dispatch flag is set, then return.
2. Initialize [this](https://webidl.spec.whatwg.org/#this) with type, bubbles, and
cancelable.
`initEvent()` is redundant with event constructors and
incapable of setting `composed`. It has to be supported for legacy content.
### 2.3. Legacy extensions to the `[Window](https://html.spec.whatwg.org/multipage/nav-history-apis.html#window)` interface
```
partial interface Window {
[Replaceable] readonly attribute (Event or undefined) event; // legacy
};
```
Each `[Window](https://html.spec.whatwg.org/multipage/nav-history-apis.html#window)` object has an associated current event (undefined or an
`Event` object). Unless stated otherwise it is undefined.
The `event` getter steps are to return [this](https://webidl.spec.whatwg.org/#this)’s
current event.
Web developers are strongly encouraged to instead rely on the `Event` object passed
to event listeners, as that will result in more portable code. This attribute is not available in
workers or worklets, and is inaccurate for events dispatched in shadow trees.
### 2.4. Interface `CustomEvent`
```
[Exposed=*]
interface CustomEvent : Event {
constructor(DOMString type, optional CustomEventInit eventInitDict = {});
readonly attribute any detail;
undefined initCustomEvent(DOMString type, optional boolean bubbles = false, optional boolean cancelable = false, optional any detail = null); // legacy
};
dictionary CustomEventInit : EventInit {
any detail = null;
};
```
Events using the
`CustomEvent` interface can be used to carry custom data.
`event = new CustomEvent(type [, eventInitDict])` Works analogously to the constructor for `Event` except
that the eventInitDict argument now
allows for setting the `detail` attribute
too.
`event . `detail`` Returns any custom data event was created with.
Typically used for synthetic events.
The `detail` attribute must return the value it
was initialized to.
The
`initCustomEvent(type, bubbles, cancelable, detail)`
method steps are:
1. If [this](https://webidl.spec.whatwg.org/#this)’s dispatch flag is set, then return.
2. Initialize [this](https://webidl.spec.whatwg.org/#this) with type, bubbles, and
cancelable.
3. Set [this](https://webidl.spec.whatwg.org/#this)’s `detail` attribute to detail.
### 2.5. Constructing events
Specifications may define
event constructing steps for all or some
events. The algorithm is passed an event event and an `EventInit` eventInitDict as indicated in the inner event creation steps.
This construct can be used by `Event` subclasses that have a more complex structure
than a simple 1:1 mapping between their initializing dictionary members and IDL attributes.
When a constructor of the `Event`
interface, or of an interface that inherits from the `Event` interface, is invoked, these steps
must be run, given the arguments type and eventInitDict:
1. Let event be the result of running the inner event creation steps with
this interface, null, now, and eventInitDict.
2. Initialize event’s `type` attribute to type.
3. Return event.
To
create an event
using eventInterface, which must be either `Event` or an interface that inherits from
it, and optionally given a [realm](https://tc39.es/ecma262/#realm) realm, run these steps:
1. If realm is not given, then set it to null.
2. Let dictionary be the result of [converting](https://webidl.spec.whatwg.org/#dfn-convert-ecmascript-to-idl-value)
the JavaScript value undefined to the dictionary type accepted by eventInterface’s
constructor. (This dictionary type will either be `EventInit` or a dictionary that inherits from
it.) This does not work if members are required; see
[whatwg/dom#600](https://github.com/whatwg/dom/issues/600).
3. Let event be the result of running the inner event creation steps with
eventInterface, realm, the time of the occurrence that the event is
signaling, and dictionary. In macOS the time of the occurrence for input
actions is available via the `timestamp` property of `NSEvent` objects.
4. Initialize event’s `isTrusted` attribute to true.
5. Return event.
Create an event is meant to be used by other specifications which need to
separately create and dispatch events, instead of simply
firing them. It ensures the event’s attributes are initialized to the
correct defaults.
The inner event creation steps, given an eventInterface,
realm, time, and dictionary, are as follows:
1. Let event be the result of creating a new object using eventInterface. If
realm is non-null, then use that realm; otherwise, use the default behavior defined in
Web IDL. As of the time of this writing Web IDL does not yet define any default behavior;
see [whatwg/webidl#135](https://github.com/whatwg/webidl/issues/135).
2. Set event’s initialized flag.
3. Initialize event’s `timeStamp` attribute to the
[relative high resolution coarse time](https://w3c.github.io/hr-time/#dfn-relative-high-resolution-coarse-time) given time and event’s
[relevant global object](https://html.spec.whatwg.org/multipage/webappapis.html#concept-relevant-global).
4. [For each](https://infra.spec.whatwg.org/#map-iterate) member → value of dictionary: if
event has an attribute whose [identifier](https://webidl.spec.whatwg.org/#dfn-identifier) is member, then
initialize that attribute to value.
5. Run the event constructing steps with event and dictionary.
6. Return event.
### 2.6. Defining event interfaces
In general, when defining a new interface that inherits from `Event` please always ask
feedback from the [WHATWG](https://whatwg.org/) or the
[W3C WebApps WG](https://www.w3.org/2008/webapps/) community.
The `CustomEvent` interface can be used as starting point.
However, do not introduce any `init*Event()`
methods as they are redundant with constructors. Interfaces that inherit
from the `Event` interface that have such a method only have it
for historical reasons.
### 2.7. Interface `EventTarget`
```
[Exposed=*]
interface EventTarget {
constructor();
undefined addEventListener(DOMString type, EventListener? callback, optional (AddEventListenerOptions or boolean) options = {});
undefined removeEventListener(DOMString type, EventListener? callback, optional (EventListenerOptions or boolean) options = {});
boolean dispatchEvent(Event event);
};
callback interface EventListener {
undefined handleEvent(Event event);
};
dictionary EventListenerOptions {
boolean capture = false;
};
dictionary AddEventListenerOptions : EventListenerOptions {
boolean passive;
boolean once = false;
AbortSignal signal;
};
```
An `EventTarget` object represents a target to which an event can be dispatched
when something has occurred.
Each `EventTarget` object has an associated event listener list (a
[list](https://infra.spec.whatwg.org/#list) of zero or more event listeners). It is initially the empty list.
An event listener can be used to observe a specific
event and consists of:
- type (a string)
- callback (null or an `EventListener` object)
- capture (a boolean, initially false)
- passive (null or a boolean, initially null)
- once (a boolean, initially false)
- signal (null or an `AbortSignal` object)
- removed (a boolean for bookkeeping purposes, initially false)
Although callback is an `EventListener`
object, an event listener is a broader concept as can be seen above.
Each `EventTarget` object also has an associated get the parent algorithm,
which takes an event event, and returns an `EventTarget` object. Unless
specified otherwise it returns null.
Nodes, shadow roots, and documents override the
get the parent algorithm.
Each `EventTarget` object can have an associated
activation behavior algorithm. The
activation behavior algorithm is passed an event, as indicated in the
dispatch algorithm.
This exists because user agents perform certain actions for certain
`EventTarget` objects, e.g., the `[area](https://html.spec.whatwg.org/multipage/image-maps.html#the-area-element)` element, in response to synthetic `[MouseEvent](https://w3c.github.io/pointerevents/#dom-mouseevent)` events whose `type` attribute is `click`. Web compatibility prevented it
from being removed and it is now the enshrined way of defining an activation of something. [HTML]
Each `EventTarget` object that has activation behavior, can additionally
have both (not either) a legacy-pre-activation behavior algorithm
and a legacy-canceled-activation behavior algorithm.
These algorithms only exist for checkbox and radio `[input](https://html.spec.whatwg.org/multipage/input.html#the-input-element)` elements and
are not to be used for anything else. [HTML]
`target = new EventTarget();` Creates a new `EventTarget` object, which can be used by developers to dispatch and
listen for events.
`target . addEventListener(type, callback [, options])` Appends an event listener for events whose `type` attribute value is
type. The callback argument sets the callback
that will be invoked when the event is dispatched.
The options argument sets listener-specific options. For compatibility this can be a
boolean, in which case the method behaves exactly as if the value was specified as
options’s `capture`.
When set to true, options’s `capture` prevents
callback from being invoked when the event’s
`eventPhase` attribute value is `BUBBLING_PHASE`. When false (or not present),
callback will not be invoked when event’s `eventPhase`
attribute value is `CAPTURING_PHASE`. Either way, callback
will be invoked if event’s `eventPhase` attribute value is `AT_TARGET`.
When set to true, options’s `passive` indicates that the
callback will not cancel the event by invoking
`preventDefault()`. This is used to enable performance optimizations described in
§ 2.8 Observing event listeners.
When set to true, options’s `once` indicates that the
callback will only be invoked once after which the event listener will
be removed.
If an `AbortSignal` is passed for options’s `signal`,
then the event listener will be removed when signal is aborted.
The event listener is appended to target’s
event listener list and is not appended if it has the same
type, callback, and
capture.
`target . removeEventListener(type, callback [, options])` Removes the event listener in target’s
event listener list with the same type, callback, and
options.
`target . dispatchEvent(event)` Dispatches a synthetic event event to target and returns true
if either event’s `cancelable` attribute value is false or its
`preventDefault()` method was not invoked; otherwise false.
To flatten options, run these
steps:
1. If options is a boolean, then return options.
2. Return options["`capture`"].
To flatten more options, run these
steps:
1. Let capture be the result of flattening options.
2. Let once be false.
3. Let passive and signal be null.
4. If options is a [dictionary](https://webidl.spec.whatwg.org/#dfn-dictionary):
1. Set once to options["`once`"].
2. If options["`passive`"] [exists](https://infra.spec.whatwg.org/#map-exists), then set passive to
options["`passive`"].
3. If options["`signal`"] [exists](https://infra.spec.whatwg.org/#map-exists), then set signal to
options["`signal`"].
5. Return capture, passive, once, and signal.
The `new EventTarget()`
constructor steps are to do nothing.
Because of the defaults stated elsewhere, the returned `EventTarget`’s
get the parent algorithm will return null, and it will have no
activation behavior, legacy-pre-activation behavior,
or legacy-canceled-activation behavior.
In the future we could allow custom get the parent algorithms. If this would be
useful, support [issue #583](https://github.com/whatwg/dom/issues/583). For now, all
author-created `EventTarget`s do not participate in a tree structure.
The default passive value, given an event type type and an `EventTarget` eventTarget, is determined as follows:
1. Return true if all of the following are true:
- type is one of "`touchstart`", "`touchmove`",
"`wheel`", or "`mousewheel`". [TOUCH-EVENTS] [UIEVENTS]
- eventTarget is a `[Window](https://html.spec.whatwg.org/multipage/nav-history-apis.html#window)` object, or is a node whose node document
is eventTarget, or is a node whose node document’s document element
is eventTarget, or is a node whose node document’s
[body element](https://html.spec.whatwg.org/multipage/dom.html#the-body-element-2) is eventTarget. [HTML]
2. Return false.
To add an event listener, given an `EventTarget` object
eventTarget and an event listener listener, run these steps:
1. If eventTarget is a `[ServiceWorkerGlobalScope](https://w3c.github.io/ServiceWorker/#serviceworkerglobalscope)` object, its
[service worker](https://w3c.github.io/ServiceWorker/#serviceworkerglobalscope-service-worker)’s
[script resource](https://w3c.github.io/ServiceWorker/#dfn-script-resource)’s
[has ever been evaluated flag](https://w3c.github.io/ServiceWorker/#dfn-has-ever-been-evaluated-flag) is set, and listener’s
type matches the `type` attribute value of any of the
[service worker events](https://w3c.github.io/ServiceWorker/#dfn-service-worker-events), then [report a warning to the console](https://console.spec.whatwg.org/#report-a-warning-to-the-console) that this might not give
the expected results. [SERVICE-WORKERS]
2. If listener’s signal is non-null and is
aborted, then return.
3. If listener’s callback is null, then return.
4. If listener’s passive is null, then set it to the
default passive value given listener’s type and
eventTarget.
5. If eventTarget’s event listener list does not [contain](https://infra.spec.whatwg.org/#list-contain) an
event listener whose type is listener’s
type, callback is listener’s
callback, and capture is
listener’s capture, then [append](https://infra.spec.whatwg.org/#list-append) listener to eventTarget’s event listener list.
6. If listener’s signal is non-null, then
add the following abort steps to it:
1. Remove an event listener with eventTarget and listener .
The add an event listener concept exists to ensure [event handlers](https://html.spec.whatwg.org/multipage/webappapis.html#event-handlers) use
the same code path. [HTML]
The
`addEventListener(type, callback, options)`
method steps are:
1. Let capture, passive, once, and signal be the
result of flattening more options.
2. Add an event listener with [this](https://webidl.spec.whatwg.org/#this) and an event listener whose
type is type, callback is
callback, capture is capture,
passive is passive, once is
once, and signal is signal.
To remove an event listener, given an `EventTarget` object
eventTarget and an event listener listener, run these steps:
1. If eventTarget is a `[ServiceWorkerGlobalScope](https://w3c.github.io/ServiceWorker/#serviceworkerglobalscope)` object and its
[service worker](https://w3c.github.io/ServiceWorker/#serviceworkerglobalscope-service-worker)’s
[set of event types to handle](https://w3c.github.io/ServiceWorker/#dfn-set-of-event-types-to-handle) [contains](https://infra.spec.whatwg.org/#list-contain) listener’s type, then [report a warning to the console](https://console.spec.whatwg.org/#report-a-warning-to-the-console)
that this might not give the expected results. [SERVICE-WORKERS]
2. Set listener’s removed to true and
[remove](https://infra.spec.whatwg.org/#list-remove) listener from eventTarget’s
event listener list.
HTML needs this to define event handlers. [HTML]
To remove all event listeners, given an `EventTarget` object
eventTarget: [for each](https://infra.spec.whatwg.org/#list-iterate) listener of eventTarget’s
event listener list: remove an event listener with
eventTarget and listener.
HTML needs this to define `document.open()`. [HTML]
The
`removeEventListener(type, callback, options)`
method steps are:
1. Let capture be the result of flattening options.
2. If [this](https://webidl.spec.whatwg.org/#this)’s event listener list [contains](https://infra.spec.whatwg.org/#list-contain) an
event listener whose type is type,
callback is callback, and
capture is capture, then remove an event listener
with [this](https://webidl.spec.whatwg.org/#this) and that event listener.
The event listener list will not contain multiple event listeners with equal
type, callback, and capture, as add an event listener
prevents that.
The `dispatchEvent(event)` method steps
are:
1. If event’s dispatch flag is set, or if its initialized flag is not
set, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an "`[InvalidStateError](https://webidl.spec.whatwg.org/#invalidstateerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
2. Initialize event’s `isTrusted` attribute to false.
3. Return the result of dispatching event to [this](https://webidl.spec.whatwg.org/#this).
### 2.8. Observing event listeners
In general, developers do not expect the presence of an event listener to be observable.
The impact of an event listener is determined by its callback. That is, a developer
adding a no-op event listener would not expect it to have any side effects.
Unfortunately, some event APIs have been designed such that implementing them efficiently
requires observing event listeners. This can make the presence of listeners observable in
that even empty listeners can have a dramatic performance impact on the behavior of the application.
For example, touch and wheel events which can be used to block asynchronous scrolling. In some cases
this problem can be mitigated by specifying the event to be `cancelable` only when there is
at least one non-`passive` listener. For example,
non-`passive` `[TouchEvent](https://w3c.github.io/touch-events/#idl-def-touchevent)` listeners must block scrolling, but if all
listeners are `passive` then scrolling can be allowed to start
[in parallel](https://html.spec.whatwg.org/multipage/infrastructure.html#in-parallel) by making the `[TouchEvent](https://w3c.github.io/touch-events/#idl-def-touchevent)` uncancelable (so that calls to
`preventDefault()` are ignored). So code dispatching an event is able to observe the absence
of non-`passive` listeners, and use that to clear the `cancelable`
property of the event being dispatched.
Ideally, any new event APIs are defined such that they do not need this property. (Use
[whatwg/dom](https://github.com/whatwg/dom/issues) for discussion.)
To legacy-obtain service worker fetch event listener callbacks given a
`[ServiceWorkerGlobalScope](https://w3c.github.io/ServiceWorker/#serviceworkerglobalscope)` global, run these steps. They return a [list](https://infra.spec.whatwg.org/#list) of
`EventListener` objects.
1. Let callbacks be « ».
2. [For each](https://infra.spec.whatwg.org/#list-iterate) listener of global’s
event listener list: if listener’s type is
"`fetch`" and listener’s callback is non-null,
then [append](https://infra.spec.whatwg.org/#list-append) listener’s callback to
callbacks.
3. Return callbacks.
### 2.9. Dispatching events
To dispatch an event event to an
`EventTarget` object target, with an optional legacy target override flag and
an optional legacyOutputDidListenersThrowFlag:
1. Set event’s dispatch flag.
2. Let targetOverride be target, if legacy target override flag
is not given, and target’s [associated `Document`](https://html.spec.whatwg.org/multipage/nav-history-apis.html#concept-document-window) otherwise.
[HTML] legacy target override flag is only used by HTML and only when
target is a `[Window](https://html.spec.whatwg.org/multipage/nav-history-apis.html#window)` object.
3. Let activationTarget be null.
4. Let relatedTarget be the result of retargeting event’s
relatedTarget against target.
5. Let clearTargets be false.
6. If target is not relatedTarget or target is event’s
relatedTarget:
1. Let touchTargets be a new [list](https://infra.spec.whatwg.org/#list).
2. [For each](https://infra.spec.whatwg.org/#list-iterate) touchTarget of event’s
touch target list: [append](https://infra.spec.whatwg.org/#list-append) the result of retargeting touchTarget against target to touchTargets.
3. Append to an event path with event, target,
targetOverride, relatedTarget, touchTargets, and false.
4. Let isActivationEvent be true, if event is a `[MouseEvent](https://w3c.github.io/pointerevents/#dom-mouseevent)` object
and event’s `type` attribute is "`click`"; otherwise false.
5. If isActivationEvent is true and target has
activation behavior, then set activationTarget to
target.
6. Let slottable be target, if target is a slottable
and is assigned, and null otherwise.
7. Let slotInClosedTree be false.
8. Let parent be the result of invoking target’s get the parent
with event.
9. While parent is non-null:
1. If slottable is non-null:
1. Assert: parent is a slot.
2. Set slottable to null.
3. If parent’s root is a shadow root whose
mode is "`closed`", then set slotInClosedTree
to true.
2. If parent is a slottable and is assigned, then
set slottable to parent.
3. Let relatedTarget be the result of retargeting event’s
relatedTarget against parent.
4. Let touchTargets be a new [list](https://infra.spec.whatwg.org/#list).
5. [For each](https://infra.spec.whatwg.org/#list-iterate) touchTarget of event’s
touch target list: [append](https://infra.spec.whatwg.org/#list-append) the result of retargeting touchTarget against parent to touchTargets.
6. If parent is a `[Window](https://html.spec.whatwg.org/multipage/nav-history-apis.html#window)` object, or parent is a node
and target’s root is a shadow-including inclusive ancestor
of parent:
1. If isActivationEvent is true, event’s `bubbles`
attribute is true, activationTarget is null, and parent has
activation behavior, then set activationTarget to
parent.
2. Append to an event path with event, parent, null,
relatedTarget, touchTargets, and slotInClosedTree.
7. Otherwise, if parent is relatedTarget, then set parent
to null.
8. Otherwise:
1. Set target to parent.
2. If isActivationEvent is true, activationTarget is null, and
target has activation behavior, then set
activationTarget to target.
3. Append to an event path with event, parent,
target, relatedTarget, touchTargets, and
slotInClosedTree.
9. If parent is non-null, then set parent to the result of invoking
parent’s get the parent with event.
10. Set slotInClosedTree to false.
10. Let clearTargetsItem be the last event path item in event’s
path whose shadow-adjusted target is non-null.
11. If clearTargetsItem’s shadow-adjusted target,
clearTargetsItem’s relatedTarget, or an `EventTarget` object
in clearTargetsItem’s touch target list is a node
whose root is a shadow root: set clearTargets to true.
12. If activationTarget is non-null and activationTarget has
legacy-pre-activation behavior, then run activationTarget’s
legacy-pre-activation behavior.
13. [For each](https://infra.spec.whatwg.org/#list-iterate) item of event’s path, in
reverse order:
1. If item’s shadow-adjusted target is non-null, then
set event’s `eventPhase` attribute to `AT_TARGET`.
2. Otherwise, set event’s `eventPhase` attribute to
`CAPTURING_PHASE`.
3. Invoke with item, event, "`capturing`", and
legacyOutputDidListenersThrowFlag if given.
14. [For each](https://infra.spec.whatwg.org/#list-iterate) item of event’s path:
1. If item’s shadow-adjusted target is non-null, then
set event’s `eventPhase` attribute to `AT_TARGET`.
2. Otherwise:
1. If event’s `bubbles` attribute is false, then
[continue](https://infra.spec.whatwg.org/#iteration-continue).
2. Set event’s `eventPhase` attribute to `BUBBLING_PHASE`.
3. Invoke with item, event, "`bubbling`", and
legacyOutputDidListenersThrowFlag if given.
7. Set event’s `eventPhase` attribute to `NONE`.
8. Set event’s `currentTarget` attribute to null.
9. Set event’s path to the empty list.
10. Unset event’s dispatch flag, stop propagation flag, and
stop immediate propagation flag.
11. If clearTargets is true:
1. Set event’s target to null.
2. Set event’s relatedTarget to null.
3. Set event’s touch target list to the empty list.
12. If activationTarget is non-null:
1. If event’s canceled flag is unset, then run
activationTarget’s activation behavior with event.
2. Otherwise, if activationTarget has
legacy-canceled-activation behavior, then run
activationTarget’s legacy-canceled-activation behavior.
13. Return false if event’s canceled flag is set; otherwise true.
To append to an event path, given an
event event, an `EventTarget` object invocationTarget, a
potential event target shadowAdjustedTarget, a potential event target relatedTarget, a [list](https://infra.spec.whatwg.org/#list) of potential event targets touchTargets, and a boolean slotInClosedTree:
1. Let invocationTargetInShadowTree be false.
2. If invocationTarget is a node and its root is a
shadow root, then set invocationTargetInShadowTree to true.
3. Let rootOfClosedTree be false.
4. If invocationTarget is a shadow root whose mode
is "`closed`", then set rootOfClosedTree to true.
5. [Append](https://infra.spec.whatwg.org/#list-append) a new event path item to event’s
path whose
invocation target is invocationTarget,
invocation-target-in-shadow-tree is invocationTargetInShadowTree,
shadow-adjusted target is shadowAdjustedTarget,
relatedTarget is relatedTarget,
touch target list is touchTargets,
root-of-closed-tree is rootOfClosedTree, and
slot-in-closed-tree is slotInClosedTree.
To invoke, given an event path item pathItem, an event event, a string phase, and an optional
legacyOutputDidListenersThrowFlag:
1. Let targetItem be pathItem.
2. While targetItem’s shadow-adjusted target is null: set
targetItem to the event path item preceding targetItem in
event’s path.
3. Set event’s target to targetItem’s
shadow-adjusted target.
4. Set event’s relatedTarget to pathItem’s
relatedTarget.
5. Set event’s touch target list to pathItem’s
touch target list.
6. If event’s stop propagation flag is set, then return.
7. Initialize event’s `currentTarget` attribute to pathItem’s
invocation target.
8. Let listeners be a [clone](https://infra.spec.whatwg.org/#list-clone) of event’s
`currentTarget` attribute value’s event listener list. This avoids event listeners added after this point from being
run. Note that removal still has an effect due to the removed field.
9. Let invocationTargetInShadowTree be pathItem’s
invocation-target-in-shadow-tree.
10. Let found be the result of running inner invoke with event,
listeners, phase, invocationTargetInShadowTree, and
legacyOutputDidListenersThrowFlag if given.
11. If found is false and event’s `isTrusted` attribute is true:
1. Let originalEventType be event’s `type` attribute value.
2. If event’s `type` attribute value is a match for any of the strings in the
first column in the following table, set event’s `type` attribute value to
the string in the second column on the same row as the matching string, and return otherwise. Event type
Legacy event type
"`animationend`"
"`webkitAnimationEnd`"
"`animationiteration`"
"`webkitAnimationIteration`"
"`animationstart`"
"`webkitAnimationStart`"
"`transitionend`"
"`webkitTransitionEnd`"
3. Inner invoke with event, listeners, phase,
invocationTargetInShadowTree, and legacyOutputDidListenersThrowFlag
if given.
4. Set event’s `type` attribute value to originalEventType.
To inner invoke, given an
event event, a [list](https://infra.spec.whatwg.org/#list) of event listeners listeners, a
string phase, a boolean invocationTargetInShadowTree, and an optional
legacyOutputDidListenersThrowFlag:
1. Let found be false.
2. [For each](https://infra.spec.whatwg.org/#list-iterate) listener of listeners, whose
removed is false:
1. If event’s `type` attribute value is not listener’s
type, then [continue](https://infra.spec.whatwg.org/#iteration-continue).
2. Set found to true.
3. If phase is "`capturing`" and listener’s
capture is false, then [continue](https://infra.spec.whatwg.org/#iteration-continue).
4. If phase is "`bubbling`" and listener’s
capture is true, then [continue](https://infra.spec.whatwg.org/#iteration-continue).
5. If listener’s once is true, then
remove an event listener given event’s `currentTarget` attribute value
and listener.
6. Let global be listener callback’s
[associated realm](https://webidl.spec.whatwg.org/#dfn-associated-realm)’s [global object](https://html.spec.whatwg.org/multipage/webappapis.html#concept-realm-global).
7. Let currentEvent be undefined.
8. If global is a `[Window](https://html.spec.whatwg.org/multipage/nav-history-apis.html#window)` object:
1. Set currentEvent to global’s current event.
2. If invocationTargetInShadowTree is false, then set global’s
current event to event.
9. If listener’s passive is true, then set
event’s in passive listener flag.
10. If global is a `[Window](https://html.spec.whatwg.org/multipage/nav-history-apis.html#window)` object, then
[record timing info for event listener](https://w3c.github.io/long-animation-frames/#record-timing-info-for-event-listener) given event and listener.
11. [Call a user object’s operation](https://webidl.spec.whatwg.org/#call-a-user-objects-operation) with listener’s
callback, "`handleEvent`", « event », and
event’s `currentTarget` attribute value. If this throws an exception
exception:
1. [Report](https://html.spec.whatwg.org/multipage/webappapis.html#report-an-exception) exception for listener’s
callback’s corresponding JavaScript object’s
[associated realm](https://webidl.spec.whatwg.org/#dfn-associated-realm)’s [global object](https://html.spec.whatwg.org/multipage/webappapis.html#concept-realm-global).
2. Set legacyOutputDidListenersThrowFlag if given. The legacyOutputDidListenersThrowFlag is only used by Indexed
Database API. [INDEXEDDB]
12. Unset event’s in passive listener flag.
13. If global is a `[Window](https://html.spec.whatwg.org/multipage/nav-history-apis.html#window)` object, then set global’s
current event to currentEvent.
14. If event’s stop immediate propagation flag is set, then
[break](https://infra.spec.whatwg.org/#iteration-break).
3. Return found.
### 2.10. Firing events
To fire an event named e at target,
optionally using an eventConstructor, with a description of how IDL attributes are to be
initialized, and a legacy target override flag, run these steps:
1. If eventConstructor is not given, then let eventConstructor be
`Event`.
2. Let event be the result of creating an event given
eventConstructor, in the [relevant realm](https://html.spec.whatwg.org/multipage/webappapis.html#concept-relevant-realm) of target.
3. Initialize event’s `type` attribute to e.
4. Initialize any other IDL attributes of event as described in the invocation of this
algorithm. This also allows for the `isTrusted` attribute to be set to false.
5. Return the result of dispatching event at target, with
legacy target override flag set if set.
Fire in the context of DOM is short for
creating, initializing, and dispatching an event.
Fire an event makes that process easier to write down.
If the event needs its `bubbles` or `cancelable` attribute initialized,
one could write "fire an event named `submit` at target with its
`cancelable` attribute initialized to true".
Or, when a custom constructor is needed, "fire an event named `click` at
target using `[MouseEvent](https://w3c.github.io/pointerevents/#dom-mouseevent)` with its `[detail](https://w3c.github.io/uievents/#dom-uievent-detail)` attribute initialized to 1".
Occasionally the return value is important:
1. Let doAction be the result of firing an event named
`like` at target.
2. If doAction is true, then …
### 2.11. Action versus occurrence
An event signifies an occurrence, not an action. Phrased differently, it
represents a notification from an algorithm and can be used to influence the future course
of that algorithm (e.g., through invoking `preventDefault()`). Events must not be
used as actions or initiators that cause some algorithm to start running. That is not what
they are for.
This is called out here specifically because previous
iterations of the DOM had a concept of "default actions" associated with events
that gave folks all the wrong ideas. Events do not represent or cause actions, they
can only be used to influence an ongoing one.
## 3. Aborting ongoing activities
Though promises do not have a built-in aborting mechanism, many APIs using them require abort
semantics. `AbortController` is meant to support these requirements by providing an
`abort()` method that toggles the state of a corresponding `AbortSignal` object.
The API which wishes to support aborting can accept an `AbortSignal` object, and use its state to
determine how to proceed.
APIs that rely upon `AbortController` are encouraged to respond to `abort()`
by rejecting any unsettled promise with the `AbortSignal`’s abort reason.
A hypothetical `doAmazingness({ ... })` method could accept an `AbortSignal` object
to support aborting as follows:
```
const controller = new AbortController(); const signal = controller.signal;
startSpinner();
doAmazingness({ ..., signal }) .then(result => ...) .catch(err => { if (err.name == 'AbortError') return;
showUserErrorMessage(); }) .then(() => stopSpinner()); // …
controller.abort();
```
`doAmazingness` could be implemented as follows:
```
function doAmazingness({signal}) { return new Promise((resolve, reject) => {
signal.throwIfAborted(); // Begin doing amazingness, and call resolve(result) when done. // But also, watch for signals:
signal.addEventListener('abort', () => { // Stop doing amazingness, and:
reject(signal.reason); }); }); }
```
APIs that do not return promises can either react in an equivalent manner or opt to not surface
the `AbortSignal`’s abort reason at all. `addEventListener()` is an
example of an API where the latter made sense.
APIs that require more granular control could extend both `AbortController` and
`AbortSignal` objects according to their needs.
### 3.1. Interface `AbortController`
```
[Exposed=*]
interface AbortController {
constructor();
[SameObject] readonly attribute AbortSignal signal;
undefined abort(optional any reason);
};
```
`controller = new AbortController()` Returns a new controller whose `signal` is set to a newly
created `AbortSignal` object.
`controller . signal` Returns the `AbortSignal` object associated with this object.
`controller . abort(reason)` Invoking this method will store reason in this object’s `AbortSignal`’s
abort reason, and signal to any observers that the associated activity is to be
aborted. If reason is undefined, then an "`[AbortError](https://webidl.spec.whatwg.org/#aborterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`
will be stored.
An `AbortController` object has an associated signal (an
`AbortSignal` object).
The
`new AbortController()`
constructor steps are:
1. Let signal be a new `AbortSignal` object.
2. Set [this](https://webidl.spec.whatwg.org/#this)’s signal to signal.
The `signal` getter steps are to return
[this](https://webidl.spec.whatwg.org/#this)’s signal.
The `abort(reason)` method steps are
to signal abort on [this](https://webidl.spec.whatwg.org/#this) with reason if it is given.
To signal abort on an `AbortController` controller with an optional reason, signal abort on
controller’s signal with reason if it is given.
### 3.2. Interface `AbortSignal`
```
[Exposed=*]
interface AbortSignal : EventTarget {
[NewObject] static AbortSignal abort(optional any reason);
[Exposed=(Window,Worker), NewObject] static AbortSignal timeout([EnforceRange] unsigned long long milliseconds);
[NewObject] static AbortSignal _any(sequence signals);
readonly attribute boolean aborted;
readonly attribute any reason;
undefined throwIfAborted();
attribute EventHandler onabort;
};
```
`AbortSignal . abort(reason)` Returns an `AbortSignal` instance whose abort reason is set to
reason if not undefined; otherwise to an "`[AbortError](https://webidl.spec.whatwg.org/#aborterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
`AbortSignal . any(signals)` Returns an `AbortSignal` instance which will be aborted once any of signals is
aborted. Its abort reason will be set to whichever one of signals
caused it to be aborted.
`AbortSignal . timeout(milliseconds)` Returns an `AbortSignal` instance which will be aborted in milliseconds
milliseconds. Its abort reason will be set to a
"`[TimeoutError](https://webidl.spec.whatwg.org/#timeouterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
`signal . aborted` Returns true if signal’s `AbortController` has signaled to abort; otherwise false.
`signal . reason` Returns signal’s abort reason.
`signal . throwIfAborted()` Throws signal’s abort reason, if signal’s
`AbortController` has signaled to abort; otherwise, does nothing.
An `AbortSignal` object has an associated abort reason (a
JavaScript value), which is initially undefined.
An `AbortSignal` object has associated abort algorithms, (a
[set](https://infra.spec.whatwg.org/#ordered-set) of algorithms which are to be executed when it is aborted),
which is initially empty.
The abort algorithms enable APIs with complex
requirements to react in a reasonable way to `abort()`. For example, a given API’s
abort reason might need to be propagated to a cross-thread environment, such as a
service worker.
An `AbortSignal` object has a dependent (a boolean), which is
initially false.
An `AbortSignal` object has associated source signals (a weak
[set](https://infra.spec.whatwg.org/#ordered-set) of `AbortSignal` objects that the object is dependent on for its
aborted state), which is initially empty.
An `AbortSignal` object has associated dependent signals (a weak
[set](https://infra.spec.whatwg.org/#ordered-set) of `AbortSignal` objects that are dependent on the object for their
aborted state), which is initially empty.
---
The static `abort(reason)` method steps
are:
1. Let signal be a new `AbortSignal` object.
2. Set signal’s abort reason to reason if it is given;
otherwise to a new "`[AbortError](https://webidl.spec.whatwg.org/#aborterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
3. Return signal .
The static `timeout(milliseconds)` method
steps are:
1. Let signal be a new `AbortSignal` object.
2. Let global be signal’s [relevant global object](https://html.spec.whatwg.org/multipage/webappapis.html#concept-relevant-global).
3. [Run steps after a timeout](https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#run-steps-after-a-timeout) given global, "`AbortSignal-timeout`",
milliseconds, and the following step: For the duration of this timeout, if signal has any event listeners registered for
its `abort` event, there must be a strong reference from global to
signal.
1. [Queue a global task](https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-global-task) on the [timer task source](https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#timer-task-source) given global to
signal abort given signal and a new
"`[TimeoutError](https://webidl.spec.whatwg.org/#timeouterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
4. Return signal.
The static `any(signals)` method
steps are to return the result of creating a dependent abort signal from signals
using `AbortSignal` and the [current realm](https://tc39.es/ecma262/#current-realm).
The `aborted` getter steps are to return true if [this](https://webidl.spec.whatwg.org/#this)
is aborted; otherwise false.
The `reason` getter steps are to return [this](https://webidl.spec.whatwg.org/#this)’s
abort reason.
The `throwIfAborted()` method steps are to throw [this](https://webidl.spec.whatwg.org/#this)’s
abort reason, if [this](https://webidl.spec.whatwg.org/#this) is aborted.
This method is primarily useful for when functions accepting `AbortSignal`s want to throw (or
return a rejected promise) at specific checkpoints, instead of passing along the `AbortSignal`
to other methods. For example, the following function allows aborting in between each attempt to
poll for a condition. This gives opportunities to abort the polling process, even though the
actual asynchronous operation (i.e., `await func()`) does not
accept an `AbortSignal`.
```
async function waitForCondition(func, targetValue, { signal } = {}) { while (true) {
signal?.throwIfAborted(); const result = await func(); if (result === targetValue) { return; } } }
```
The `onabort` attribute is an
[event handler IDL attribute](https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-idl-attributes) for the `onabort` [event handler](https://html.spec.whatwg.org/multipage/webappapis.html#event-handlers), whose [event handler event type](https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-event-type) is
`abort`.
Changes to an `AbortSignal` object represent the wishes of the corresponding
`AbortController` object, but an API observing the `AbortSignal` object can choose to ignore
them. For instance, if the operation has already completed.
---
An `AbortSignal` object is aborted when its
abort reason is not undefined.
To add an algorithm algorithm to an `AbortSignal`
object signal:
1. If signal is aborted, then return.
2. [Append](https://infra.spec.whatwg.org/#set-append) algorithm to signal’s
abort algorithms.
To remove an algorithm algorithm from an
`AbortSignal` signal, [remove](https://infra.spec.whatwg.org/#list-remove) algorithm from
signal’s abort algorithms.
To signal abort, given an `AbortSignal` object signal and
an optional reason:
1. If signal is aborted, then return.
2. Set signal’s abort reason to reason if it is given;
otherwise to a new "`[AbortError](https://webidl.spec.whatwg.org/#aborterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
3. Let dependentSignalsToAbort be a new [list](https://infra.spec.whatwg.org/#list).
4. [For each](https://infra.spec.whatwg.org/#list-iterate) dependentSignal of signal’s
dependent signals:
1. If dependentSignal is not aborted:
1. Set dependentSignal’s abort reason to signal’s
abort reason.
2. [Append](https://infra.spec.whatwg.org/#list-append) dependentSignal to
dependentSignalsToAbort.
5. Run the abort steps for signal.
6. [For each](https://infra.spec.whatwg.org/#list-iterate) dependentSignal of dependentSignalsToAbort,
run the abort steps for dependentSignal.
To run the abort steps for an `AbortSignal` signal:
1. [For each](https://infra.spec.whatwg.org/#list-iterate) algorithm of signal’s
abort algorithms: run algorithm.
2. [Empty](https://infra.spec.whatwg.org/#list-empty) signal’s abort algorithms.
3. Fire an event named `abort` at signal.
To create a dependent abort signal from a list of `AbortSignal` objects
signals, using signalInterface, which must be either `AbortSignal` or an
interface that inherits from it, and a realm:
1. Let resultSignal be a [new](https://webidl.spec.whatwg.org/#new) object implementing
signalInterface using realm.
2. [For each](https://infra.spec.whatwg.org/#list-iterate) signal of signals: if signal is
aborted, then set resultSignal’s abort reason to
signal’s abort reason and return resultSignal.
3. Set resultSignal’s dependent to true.
4. [For each](https://infra.spec.whatwg.org/#list-iterate) signal of signals:
1. If signal’s dependent is false:
1. [Append](https://infra.spec.whatwg.org/#set-append) signal to resultSignal’s
source signals.
2. [Append](https://infra.spec.whatwg.org/#set-append) resultSignal to signal’s
dependent signals.
2. Otherwise, [for each](https://infra.spec.whatwg.org/#list-iterate) sourceSignal of signal’s
source signals:
1. Assert: sourceSignal is not aborted and not
dependent.
2. [Append](https://infra.spec.whatwg.org/#set-append) sourceSignal to resultSignal’s
source signals.
3. [Append](https://infra.spec.whatwg.org/#set-append) resultSignal to sourceSignal’s
dependent signals.
5. Return resultSignal.
#### 3.2.1. Garbage collection
A non-aborted dependent `AbortSignal` object must not be
garbage collected while its source signals is non-empty and it has registered event
listeners for its `abort` event or its abort algorithms is non-empty.
### 3.3. Using `AbortController` and `AbortSignal` objects in
APIs
Any web platform API using promises to represent operations that can be aborted must adhere to
the following:
- Accept `AbortSignal` objects through a `signal` dictionary member.
- Convey that the operation got aborted by rejecting the promise with `AbortSignal` object’s abort reason .
- Reject immediately if the `AbortSignal` is already aborted , otherwise:
- Use the abort algorithms mechanism to observe changes to the `AbortSignal` object and do so in a manner that does not lead to clashes with other observers.
The method steps for a promise-returning method `doAmazingness(options)`
could be as follows:
1. Let global be [this](https://webidl.spec.whatwg.org/#this)’s [relevant global object](https://html.spec.whatwg.org/multipage/webappapis.html#concept-relevant-global).
2. Let p be [a new promise](https://webidl.spec.whatwg.org/#a-new-promise).
3. If options["`signal`"] [exists](https://infra.spec.whatwg.org/#map-exists):
1. Let signal be options["`signal`"].
2. If signal is aborted, then [reject](https://webidl.spec.whatwg.org/#reject) p with signal’s
abort reason and return p.
3. Add the following abort steps to signal:
1. Stop doing amazing things.
2. [Reject](https://webidl.spec.whatwg.org/#reject) p with signal’s abort reason.
4. Run these steps [in parallel](https://html.spec.whatwg.org/multipage/infrastructure.html#in-parallel):
1. Let amazingResult be the result of doing some amazing things.
2. [Queue a global task](https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-global-task) on the amazing task source given global to [resolve](https://webidl.spec.whatwg.org/#resolve) p
with amazingResult.
5. Return p.
APIs not using promises should still adhere to the above as much as possible.
## 4. Nodes
### 4.1. Introduction to "The DOM"
In its original sense, "The DOM" is an API for
accessing and manipulating documents (in particular, HTML and XML
documents). In this specification, the term "document" is used for any
markup-based resource, ranging from short static documents to long essays or
reports with rich multimedia, as well as to fully-fledged interactive
applications.
Each such document is represented as a node tree. Some of the nodes in a
tree can have children, while others are always leaves.
To illustrate, consider this HTML document:
```
Aliens? Why yes.
```
It is represented as follows:
- Document
- Doctype : `html`
- `Element` : `html` `class`="`e`"
- `Element` : `head`
- `Element` : `title`
- `Text` : Aliens?
- `Text` : ⏎␣
- `Element` : `body`
- `Text` : Why yes.⏎
Note that, due to the magic that is [HTML parsing](https://html.spec.whatwg.org/multipage/parsing.html#html-parser), not all
[ASCII whitespace](https://infra.spec.whatwg.org/#ascii-whitespace) were turned into `Text` nodes, but the general concept is
clear. Markup goes in, a tree of nodes comes out.
The most excellent
[Live DOM Viewer](https://software.hixie.ch/utilities/js/live-dom-viewer/)
can be used to explore this matter in more detail.
### 4.2. Node tree
Nodes are objects that [implement](https://webidl.spec.whatwg.org/#implements) `Node`.
Nodes participate in a tree, which is known as the
node tree.
In practice you deal with more specific objects.
Objects that [implement](https://webidl.spec.whatwg.org/#implements) `Node` also implement an inherited interface: `Document`,
`DocumentType`, `DocumentFragment`, `Element`, `CharacterData`, or `Attr`.
Objects that implement `DocumentFragment` sometimes implement `ShadowRoot`.
Objects that implement `Element` also typically implement an inherited interface, such as
`[HTMLAnchorElement](https://html.spec.whatwg.org/multipage/text-level-semantics.html#htmlanchorelement)`.
Objects that implement `CharacterData` also implement an inherited interface: `Text`,
`ProcessingInstruction`, or .
Objects that implement `Text` sometimes implement `CDATASection`.
Thus, every node’s [primary interface](https://webidl.spec.whatwg.org/#dfn-primary-interface) is one of: `Document`, `DocumentType`,
`DocumentFragment`, `ShadowRoot`, `Element` or an inherited interface of `Element`,
`Attr`, `Text`, `CDATASection`, `ProcessingInstruction`, or `Comment`.
For brevity, this specification refers to an object that [implements](https://webidl.spec.whatwg.org/#implements) `Node` and an
inherited interface `NodeInterface`, as a
`NodeInterface` node.
A node tree is constrained as follows, expressed as a relationship between a
node and its potential children:
`Document` In tree order:
Zero or more `ProcessingInstruction` or `Comment` nodes.
Optionally one `DocumentType` node.
Zero or more `ProcessingInstruction` or `Comment` nodes.
Optionally one `Element` node.
Zero or more `ProcessingInstruction` or `Comment` nodes.
`DocumentFragment`
`Element` Zero or more `Element` or `CharacterData` nodes.
`DocumentType`
`CharacterData`
`Attr` No children.
`Attr` nodes participate in a tree for historical
reasons; they never have a (non-null) parent or any children and are
therefore alone in a tree.
To determine the length of a node node, run these steps:
1. If node is a `DocumentType` or `Attr` node, then return 0.
2. If node is a `CharacterData` node, then return node’s
data’s [length](https://infra.spec.whatwg.org/#string-length).
3. Return the number of node’s children.
A node is considered empty if its
length is 0.
#### 4.2.1. Document tree
A document tree is a node tree whose
root is a document.
The document element of a document is the element
whose parent is that document, if it exists; otherwise null.
Per the node tree constraints, there can be only one such
element.
A node is in a document tree if its root is a
document.
A node is in a document if it is in a document tree.
The term in a document is no longer supposed to be used. It indicates that
the standard using it has not been updated to account for shadow trees.
#### 4.2.2. Shadow tree
A shadow tree is a node tree whose
root is a shadow root.
A shadow root is always attached to another node tree through its
host. A shadow tree is therefore never alone. The
node tree of a shadow root’s host is sometimes
referred to as the light tree.
A shadow tree’s corresponding light tree can be a shadow tree
itself.
A node is connected if its
shadow-including root is a document.
##### 4.2.2.1. Slots
A shadow tree contains zero or more elements that are
slots.
A slot can only be created through HTML’s `[slot](https://html.spec.whatwg.org/multipage/scripting.html#the-slot-element)` element.
A slot has an associated name (a string). Unless stated
otherwise it is the empty string.
Use these attribute change steps to update a slot’s name:
1. If element is a slot, localName is `name`, and
namespace is null:
1. If value is oldValue, then return.
2. If value is null and oldValue is the empty string, then return.
3. If value is the empty string and oldValue is null, then return.
4. If value is null or the empty string, then set element’s
name to the empty string.
5. Otherwise, set element’s name to value.
6. Run assign slottables for a tree with element’s root.
The first slot in a shadow tree, in tree order, whose
name is the empty string, is sometimes known as the "default slot".
A slot has an associated assigned nodes (a list of
slottables). Unless stated otherwise it is empty.
##### 4.2.2.2. Slottables
`Element` and `Text` nodes are
slottables.
A slot can be a slottable.
A slottable has an associated name (a
string). Unless stated otherwise it is the empty string.
Use these attribute change steps to update a slottable’s name:
1. If localName is `slot` and namespace is null:
1. If value is oldValue, then return.
2. If value is null and oldValue is the empty string, then return.
3. If value is the empty string and oldValue is null, then return.
4. If value is null or the empty string, then set element’s
name to the empty string.
5. Otherwise, set element’s name to value.
6. If element is assigned, then run assign slottables
for element’s assigned slot.
7. Run assign a slot for element.
A slottable has an associated
assigned slot (null or a slot).
Unless stated otherwise it is null. A slottable is
assigned if its assigned slot is
non-null.
A slottable has an associated manual slot assignment (null
or a slot). Unless stated otherwise, it is null.
A slottable’s manual slot assignment can be implemented using a weak
reference to the slot, because this variable is not directly accessible from script.
##### 4.2.2.3. Finding slots and slottables
To find a slot for a given slottable slottable and an optional
boolean open (default false):
1. If slottable’s parent is null, then return null.
2. Let shadow be slottable’s parent’s
shadow root.
3. If shadow is null, then return null.
4. If open is true and shadow’s mode is not
"`open`", then return null.
5. If shadow’s slot assignment is "`manual`", then
return the slot in shadow’s descendants whose
[manually assigned nodes](https://html.spec.whatwg.org/multipage/scripting.html#manually-assigned-nodes) [contains](https://infra.spec.whatwg.org/#list-contain) slottable, if any; otherwise
null.
6. Return the first slot in tree order in shadow’s
descendants whose name is slottable’s
name, if any; otherwise null.
To find slottables for a given slot slot:
1. Let result be « ».
2. Let root be slot’s root.
3. If root is not a shadow root, then return result.
4. Let host be root’s host.
5. If root’s slot assignment is "`manual`":
1. [For each](https://infra.spec.whatwg.org/#list-iterate) slottable slottable of slot’s
[manually assigned nodes](https://html.spec.whatwg.org/multipage/scripting.html#manually-assigned-nodes), if slottable’s parent is
host, [append](https://infra.spec.whatwg.org/#list-append) slottable to result.
6. Otherwise, for each slottable child slottable of
host, in tree order:
1. Let foundSlot be the result of finding a slot given
slottable.
2. If foundSlot is slot, then [append](https://infra.spec.whatwg.org/#list-append) slottable to result.
7. Return result.
To find flattened slottables for a given
slot slot:
1. Let result be « ».
2. If slot’s root is not a shadow root, then return
result.
3. Let slottables be the result of finding slottables given
slot.
4. If slottables is the empty list, then append each slottable child of slot, in tree order, to slottables.
5. For each node of slottables:
1. If node is a slot whose root is a shadow root:
1. Let temporaryResult be the result of finding flattened slottables given
node.
2. Append each slottable in temporaryResult, in order, to
result.
2. Otherwise, append node to result.
6. Return result.
##### 4.2.2.4. Assigning slottables and slots
To assign slottables for a slot slot:
1. Let slottables be the result of finding slottables for slot.
2. If slottables and slot’s assigned nodes are not
identical, then run signal a slot change for slot.
3. Set slot’s assigned nodes to slottables.
4. For each slottable of slottables: set slottable’s
assigned slot to slot.
To assign slottables for a tree, given a
node root, run assign slottables for each slot of
root’s inclusive descendants, in tree order.
To assign a slot, given a slottable slottable:
1. Let slot be the result of finding a slot with slottable.
2. If slot is non-null, then run assign slottables for slot.
##### 4.2.2.5. Signaling slot change
Each [similar-origin window agent](https://html.spec.whatwg.org/multipage/webappapis.html#similar-origin-window-agent) has signal slots
(a [set](https://infra.spec.whatwg.org/#ordered-set) of slots), which is initially empty. [HTML]
To signal a slot change, for a slot slot:
1. [Append](https://infra.spec.whatwg.org/#set-append) slot to slot’s [relevant agent](https://html.spec.whatwg.org/multipage/webappapis.html#relevant-agent)’s
signal slots.
2. Queue a mutation observer microtask.
#### 4.2.3. Mutation algorithms
To ensure pre-insert validity given a
node node, a node parent, null or a
node child, and a [list](https://infra.spec.whatwg.org/#list) of nodes childrenToExclude:
1. If parent is not a `Document`, `DocumentFragment`, or `Element` node, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
2. If node is a host-including inclusive ancestor of parent, then
[throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
3. If child is non-null and its parent is not parent,
then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NotFoundError](https://webidl.spec.whatwg.org/#notfounderror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
4. If node is not a `DocumentFragment`, `DocumentType`, `Element`, or
`CharacterData` node, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a
"`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
5. If parent is not a document:
1. If node is a doctype, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a
"`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
2. Return.
6. If node is a `Text` node, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a
"`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
7. If node is a `CharacterData` node, then return.
8. If node is a `DocumentFragment` node:
1. If node has more than one element child or has a
`Text` node child, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a
"`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
2. If node has no element child, then return.
9. If node is a `DocumentFragment` or `Element` node:
1. If any of the following are true: then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
- parent has an element child that
childrenToExclude does not [contain](https://infra.spec.whatwg.org/#list-contain);
- child is non-null and a doctype is following child;
or
- child is a doctype that childrenToExclude does not
[contain](https://infra.spec.whatwg.org/#list-contain),
2. Return.
10. [Assert](https://infra.spec.whatwg.org/#assert): node is a doctype.
11. If any of the following are true: then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
- parent has a doctype child that
childrenToExclude does not [contain](https://infra.spec.whatwg.org/#list-contain);
- child is non-null and an element is preceding child; or
- child is null and parent has an element child that childrenToExclude does not [contain](https://infra.spec.whatwg.org/#list-contain),
To pre-insert a node node
into a node parent before null or node child:
1. Ensure pre-insert validity given node, parent,
child, and « ».
2. Let referenceChild be child.
3. If referenceChild is node, then set referenceChild to
node’s next sibling.
4. Insert node into parent before referenceChild.
5. Return node.
Specifications may define
insertion steps for all or some nodes. The
algorithm is passed insertedNode, as indicated in the insert algorithm
below. These steps must not modify the node tree that insertedNode participates in, create [browsing contexts](https://html.spec.whatwg.org/multipage/document-sequences.html#browsing-context),
fire events, or otherwise execute JavaScript. These steps may
[queue tasks](https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-global-task) to do these things asynchronously, however.
While the insertion steps cannot execute JavaScript (among other things), they will
indeed have script-observable consequences. Consider the below example:
```
const h1 = document.querySelector('h1'); const fragment = new DocumentFragment(); const script = fragment.appendChild(document.createElement('script')); const style = fragment.appendChild(document.createElement('style'));
script.innerText= 'console.log(getComputedStyle(h1).color)'; // Logs 'rgb(255, 0, 0)'
style.innerText = 'h1 {color: rgb(255, 0, 0);}';
document.body.append(fragment);
```
The script in the above example logs `'rgb(255, 0, 0)'` because
the following happen in order:
1. The insert algorithm runs, which will insert the `[script](https://html.spec.whatwg.org/multipage/scripting.html#script)` and `[style](https://html.spec.whatwg.org/multipage/semantics.html#the-style-element)` elements in order.
1. The HTML Standard’s insertion steps run for the `[script](https://html.spec.whatwg.org/multipage/scripting.html#script)` element; they do
nothing. [HTML]
2. The HTML Standard’s insertion steps run for the `[style](https://html.spec.whatwg.org/multipage/semantics.html#the-style-element)` element; they immediately apply its style rules to the
document. [HTML]
3. The HTML Standard’s post-connection steps run for the `[script](https://html.spec.whatwg.org/multipage/scripting.html#script)` element; they run
the script, which immediately observes the style rules that were applied in the above step.
[HTML]
Specifications may also define
post-connection steps for all or some
nodes. The algorithm is passed connectedNode, as indicated in the
insert algorithm below.
The purpose of the post-connection steps is to provide an opportunity for
nodes to perform any connection-related operations that modify the node tree
that connectedNode participates in, create [browsing contexts](https://html.spec.whatwg.org/multipage/document-sequences.html#browsing-context),
or otherwise execute JavaScript. These steps allow a batch of nodes to be
inserted *atomically* with respect to script, with all major side effects
occurring *after* the batch insertions into the node tree is complete. This ensures
that all pending node tree insertions completely finish before more insertions can occur.
Specifications may define
children changed steps for all or some
nodes. The algorithm is passed no argument and is called from insert,
remove, and replace data.
To insert a node node into a
node parent before null or a node child, with an
optional boolean suppressObservers (default false):
1. Let nodes be node’s children, if node is a
`DocumentFragment` node; otherwise « node ».
2. Let count be nodes’s [size](https://infra.spec.whatwg.org/#list-size).
3. If count is 0, then return.
4. If node is a `DocumentFragment` node:
1. Remove its children with
*suppressObservers* set to true.
2. Queue a tree mutation record for node with « », nodes, null, and
null. This step intentionally does not pay attention to suppressObservers.
5. If child is non-null:
1. For each live range whose start node is parent and
start offset is greater than child’s index: increase
its start offset by count.
2. For each live range whose end node is parent and
end offset is greater than child’s index: increase
its end offset by count.
6. Let previousSibling be child’s previous sibling or
parent’s last child if child is null.
7. For each node in nodes, in tree order:
1. Adopt node into parent’s node document.
2. If child is null, then [append](https://infra.spec.whatwg.org/#set-append) node to
parent’s children.
3. Otherwise, [insert](https://infra.spec.whatwg.org/#list-insert) node into parent’s
children before child’s index.
4. If parent is a shadow host whose shadow root’s
slot assignment is "`named`" and node is a
slottable, then assign a slot for node.
5. If parent’s root is a shadow root, and
parent is a slot whose assigned nodes is the empty list,
then run signal a slot change for parent.
6. Run assign slottables for a tree with node’s root.
7. For each shadow-including inclusive descendant inclusiveDescendant of
node, in shadow-including tree order:
1. Run the insertion steps with inclusiveDescendant.
2. If inclusiveDescendant is not connected, then
[continue](https://infra.spec.whatwg.org/#iteration-continue).
3. If inclusiveDescendant is an element and
inclusiveDescendant’s custom element registry is non-null:
1. If inclusiveDescendant’s custom element registry’s
[is scoped](https://html.spec.whatwg.org/multipage/custom-elements.html#is-scoped) is true, then [append](https://infra.spec.whatwg.org/#set-append) inclusiveDescendant’s node document to
inclusiveDescendant’s custom element registry’s
[scoped document set](https://html.spec.whatwg.org/multipage/custom-elements.html#scoped-document-set).
2. If inclusiveDescendant is custom, then
[enqueue a custom element callback reaction](https://html.spec.whatwg.org/multipage/custom-elements.html#enqueue-a-custom-element-callback-reaction) with inclusiveDescendant,
callback name "`connectedCallback`", and « ».
3. Otherwise, [try to upgrade](https://html.spec.whatwg.org/multipage/custom-elements.html#concept-try-upgrade) inclusiveDescendant. If this successfully upgrades inclusiveDescendant, its
`connectedCallback` will be enqueued automatically during the
[upgrade an element](https://html.spec.whatwg.org/multipage/custom-elements.html#concept-upgrade-an-element) algorithm.
4. Otherwise, if inclusiveDescendant is a shadow root,
inclusiveDescendant’s custom element registry is non-null, and
inclusiveDescendant’s custom element registry’s
[is scoped](https://html.spec.whatwg.org/multipage/custom-elements.html#is-scoped) is true, then [append](https://infra.spec.whatwg.org/#set-append) inclusiveDescendant’s node document to
inclusiveDescendant’s custom element registry’s
[scoped document set](https://html.spec.whatwg.org/multipage/custom-elements.html#scoped-document-set).
8. If suppressObservers is false, then queue a tree mutation record for
parent with nodes, « », previousSibling, and child.
9. Run the children changed steps for parent.
10. Let staticNodeList be a [list](https://infra.spec.whatwg.org/#list) of nodes, initially « ». We collect all nodes *before* calling the
post-connection steps on any one of them, instead of calling the
post-connection steps *while* we’re traversing the node tree. This is because
the post-connection steps can modify the tree’s structure, making live traversal unsafe,
possibly leading to the post-connection steps being called multiple times on the same
node.
11. For each node of nodes, in tree order:
1. For each shadow-including inclusive descendant inclusiveDescendant of
node, in shadow-including tree order: [append](https://infra.spec.whatwg.org/#list-append) inclusiveDescendant to staticNodeList.
12. [For each](https://infra.spec.whatwg.org/#list-iterate) node of staticNodeList: if node is
connected, then run the post-connection steps with node.
To append a node node to a
node parent: pre-insert node into parent before
null.
---
Specifications may define
moving steps for all or some nodes. The
algorithm is passed a node movedNode, a boolean
isSubtreeRoot, and a node oldAncestor
as indicated in the move algorithm below. Like the
insertion steps, these steps must not modify the node tree that
movedNode participates in, create [browsing contexts](https://html.spec.whatwg.org/multipage/document-sequences.html#browsing-context),
fire events, or otherwise execute JavaScript. These steps may queue tasks
to do these things asynchronously, however.
To move a node node into a node newParent before null or a node child:
1. If newParent’s shadow-including root is not the same as
node’s shadow-including root, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a
"`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`. This has the side effect of ensuring that a move is only performed if
newParent’s connected is node’s connected.
2. If node is a host-including inclusive ancestor of newParent,
then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
3. If child is non-null and its parent is not newParent,
then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NotFoundError](https://webidl.spec.whatwg.org/#notfounderror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
4. If node is not an `Element` or a `CharacterData` node, then
[throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
5. If node is a `Text` node and newParent is a
document, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
6. If newParent is a document, node is an `Element` node, and either newParent has an element child, child is a doctype, or child is non-null and a
doctype is following child then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a
"`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
7. Let oldParent be node’s parent.
8. [Assert](https://infra.spec.whatwg.org/#assert): oldParent is non-null.
9. Run the live range pre-remove steps, given node.
10. For each `NodeIterator` object iterator whose
root’s node document is node’s
node document: run the `NodeIterator` pre-remove steps given
node and iterator.
11. Let oldPreviousSibling be node’s previous sibling.
12. Let oldNextSibling be node’s next sibling.
13. [Remove](https://infra.spec.whatwg.org/#list-remove) node from oldParent’s children.
14. If node is assigned, then run assign slottables for
node’s assigned slot.
15. If oldParent’s root is a shadow root, and
oldParent is a slot whose assigned nodes [is empty](https://infra.spec.whatwg.org/#list-is-empty), then run signal a slot change for oldParent.
16. If node has an inclusive descendant that is a slot:
1. Run assign slottables for a tree with oldParent’s root.
2. Run assign slottables for a tree with node.
17. If child is non-null:
1. For each live range whose start node is newParent and
start offset is greater than child’s index: increase
its start offset by 1.
2. For each live range whose end node is newParent and
end offset is greater than child’s index: increase
its end offset by 1.
18. Let newPreviousSibling be child’s previous sibling if
child is non-null, and newParent’s last child otherwise.
19. If child is null, then [append](https://infra.spec.whatwg.org/#set-append) node to
newParent’s children.
20. Otherwise, [insert](https://infra.spec.whatwg.org/#list-insert) node into newParent’s
children before child’s index.
21. If newParent is a shadow host whose shadow root’s
slot assignment is "`named`" and node is a
slottable, then assign a slot for node.
22. If newParent’s root is a shadow root, and
newParent is a slot whose assigned nodes [is empty](https://infra.spec.whatwg.org/#list-is-empty), then run signal a slot change for newParent.
23. Run assign slottables for a tree with node’s root.
24. For each shadow-including inclusive descendant inclusiveDescendant of
node, in shadow-including tree order:
1. Let isSubtreeRoot be true if inclusiveDescendant is
node; otherwise false.
2. Run the moving steps with inclusiveDescendant, isSubtreeRoot,
and oldParent. Because the move algorithm is a separate primitive from
insert and remove, it does not invoke the insertion steps
or removing steps for inclusiveDescendant.
3. If inclusiveDescendant is custom and newParent is
connected, then [enqueue a custom element callback reaction](https://html.spec.whatwg.org/multipage/custom-elements.html#enqueue-a-custom-element-callback-reaction) with
inclusiveDescendant, callback name "`connectedMoveCallback`", and « ».
25. Queue a tree mutation record for oldParent with « », « node »,
oldPreviousSibling, and oldNextSibling.
26. Queue a tree mutation record for newParent with « node », « »,
newPreviousSibling, and child.
---
To replace a node child with
a node node within a node parent:
1. Ensure pre-insert validity given node, parent,
child, and « child ».
2. Let referenceChild be child’s next sibling.
3. If referenceChild is node, then set referenceChild to
node’s next sibling.
4. Let previousSibling be child’s previous sibling.
5. Let removedNodes be the empty set.
6. Adopt node into parent’s node document.
7. If child’s parent is non-null: The above can only be false if child is node.
1. Set removedNodes to « child ».
2. Remove child with *suppressObservers* set
to true.
8. Let nodes be node’s children if node is a
`DocumentFragment` node; otherwise « node ».
9. Insert node into parent before referenceChild
with *suppressObservers* set to true.
10. Queue a tree mutation record for parent with nodes,
removedNodes, previousSibling, and referenceChild.
11. Return child.
To replace all with a node or
null node within a node parent:
1. Let removedNodes be parent’s children.
2. Let addedNodes be the empty set.
3. If node is a `DocumentFragment` node, then set
addedNodes to node’s children.
4. Otherwise, if node is non-null, set addedNodes to « node ».
5. Remove all parent’s children, in tree order,
with *suppressObservers* set to true.
6. If node is non-null, then insert node into
parent before null with *suppressObservers* set to true.
7. If either addedNodes or removedNodes [is not empty](https://infra.spec.whatwg.org/#list-is-empty),
then queue a tree mutation record for parent with addedNodes,
removedNodes, null, and null.
This algorithm does not make any checks with regards to the
node tree constraints. Specification authors need to use it wisely.
---
To pre-remove a node child
from a node parent:
1. If child’s parent is not parent, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a
"`[NotFoundError](https://webidl.spec.whatwg.org/#notfounderror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
2. Remove child.
3. Return child.
Specifications may define
removing steps for all or some nodes. The
algorithm is passed a node removedNode, a boolean
isSubtreeRoot, and a node oldAncestor as indicated
in the remove algorithm below.
To remove a node node, with an
optional boolean suppressObservers (default false):
1. Let parent be node’s parent.
2. Assert: parent is non-null.
3. Run the live range pre-remove steps, given node.
4. For each `NodeIterator` object iterator whose
root’s node document is node’s
node document: run the `NodeIterator` pre-remove steps given
node and iterator.
5. Let oldPreviousSibling be node’s previous sibling.
6. Let oldNextSibling be node’s next sibling.
7. [Remove](https://infra.spec.whatwg.org/#list-remove) node from its parent’s children.
8. If node is assigned, then run assign slottables for
node’s assigned slot.
9. If parent’s root is a shadow root, and
parent is a slot whose assigned nodes is the empty list,
then run signal a slot change for parent.
10. If node has an inclusive descendant that is a slot:
1. Run assign slottables for a tree with parent’s root.
2. Run assign slottables for a tree with node.
11. Run the removing steps with node, true, and parent.
12. Let isParentConnected be parent’s connected.
13. If node is custom and isParentConnected is true, then
[enqueue a custom element callback reaction](https://html.spec.whatwg.org/multipage/custom-elements.html#enqueue-a-custom-element-callback-reaction) with node, callback name
"`disconnectedCallback`", and « ». It is intentional for now that custom elements do
not get parent passed. This might change in the future if there is a need.
14. For each shadow-including descendant descendant of node, in
shadow-including tree order:
1. Run the removing steps with descendant, false, and parent.
2. If descendant is custom and isParentConnected
is true, then [enqueue a custom element callback reaction](https://html.spec.whatwg.org/multipage/custom-elements.html#enqueue-a-custom-element-callback-reaction) with descendant,
callback name "`disconnectedCallback`", and « ».
15. For each inclusive ancestor inclusiveAncestor of
parent, and then [for each](https://infra.spec.whatwg.org/#list-iterate) registered of
inclusiveAncestor’s registered observer list, if registered’s
options["`subtree`"] is true, then
[append](https://infra.spec.whatwg.org/#list-append) a new transient registered observer whose
observer is registered’s
observer, options is
registered’s options, and
source is registered to node’s
registered observer list.
16. If suppressObservers is false, then queue a tree mutation record for
parent with « », « node », oldPreviousSibling, and
oldNextSibling.
17. Run the children changed steps for parent.
#### 4.2.4. Mixin `NonElementParentNode`
Web compatibility prevents the `getElementById()`
method from being exposed on elements (and therefore on `ParentNode`).
```
interface mixin NonElementParentNode {
Element? getElementById(DOMString elementId);
};
Document includes NonElementParentNode;
DocumentFragment includes NonElementParentNode;
```
`node . getElementById(elementId)` Returns the first element within node’s descendants
whose ID is elementId.
To get an element by ID, given a node node and a
string elementId, return the first element, in tree order, within
node’s descendants, whose ID is elementId;
otherwise, if there is no such element, null.
The `getElementById(elementId)`
method steps are to return the result of getting an element by ID given [this](https://webidl.spec.whatwg.org/#this) and
elementId.
#### 4.2.5. Mixin `DocumentOrShadowRoot`
```
interface mixin DocumentOrShadowRoot {
readonly attribute CustomElementRegistry? customElementRegistry;
};
Document includes DocumentOrShadowRoot;
ShadowRoot includes DocumentOrShadowRoot;
```
`registry = documentOrShadowRoot . `customElementRegistry`` Returns documentOrShadowRoot’s `[CustomElementRegistry](https://html.spec.whatwg.org/multipage/custom-elements.html#customelementregistry)` object, if any;
otherwise null.
The `customElementRegistry` getter steps
are:
1. If [this](https://webidl.spec.whatwg.org/#this) is a document, then return [this](https://webidl.spec.whatwg.org/#this)’s
custom element registry.
2. [Assert](https://infra.spec.whatwg.org/#assert): [this](https://webidl.spec.whatwg.org/#this) is a `ShadowRoot` node.
3. Return [this](https://webidl.spec.whatwg.org/#this)’s custom element registry.
The `DocumentOrShadowRoot` mixin is also expected to be used by other
standards that want to define APIs shared between documents and
shadow roots.
#### 4.2.6. Mixin `ParentNode`
To convert nodes into a node, given a [list](https://infra.spec.whatwg.org/#list) of nodes and
strings nodes, and document document:
1. Replace each string in nodes with the result of creating a text node given
document and the string.
2. If nodes’s [size](https://infra.spec.whatwg.org/#list-size) is 1, then return nodes[0].
3. Let fragment be the result of creating a document fragment given
document.
4. For each node of nodes: append node to
fragment.
5. Return fragment.
```
interface mixin ParentNode {
[SameObject] readonly attribute HTMLCollection children;
readonly attribute Element? firstElementChild;
readonly attribute Element? lastElementChild;
readonly attribute unsigned long childElementCount;
[CEReactions, Unscopable] undefined prepend((Node or DOMString)... nodes);
[CEReactions, Unscopable] undefined append((Node or DOMString)... nodes);
[CEReactions, Unscopable] undefined replaceChildren((Node or DOMString)... nodes);
[CEReactions] undefined moveBefore(Node node, Node? child);
Element? querySelector(DOMString selectors);
[NewObject] NodeList querySelectorAll(DOMString selectors);
};
Document includes ParentNode;
DocumentFragment includes ParentNode;
Element includes ParentNode;
```
`collection = node . `children`` Returns the child elements.
`element = node . `firstElementChild`` Returns the first child that is an element; otherwise null.
`element = node . `lastElementChild`` Returns the last child that is an element; otherwise null.
`node . prepend(nodes)` Inserts nodes before the first child of node, while
replacing strings in nodes with equivalent `Text` nodes.
[Throws](https://webidl.spec.whatwg.org/#dfn-throw) a "`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)` if the constraints of
the node tree are violated.
`node . append(nodes)` Inserts nodes after the last child of node, while replacing
strings in nodes with equivalent `Text` nodes.
[Throws](https://webidl.spec.whatwg.org/#dfn-throw) a "`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)` if the constraints of
the node tree are violated.
`node . replaceChildren(nodes)` Replace all children of node with nodes,
while replacing strings in nodes with equivalent `Text` nodes.
[Throws](https://webidl.spec.whatwg.org/#dfn-throw) a "`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)` if the constraints of
the node tree are violated.
`node . moveBefore(movedNode, child)` Moves, without first removing, movedNode into node after child
if child is non-null; otherwise after the last child of node. This
method preserves state associated with movedNode.
[Throws](https://webidl.spec.whatwg.org/#dfn-throw) a "`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)` if the constraints of
the node tree are violated, or the state associated with the moved node cannot be
preserved.
`node . querySelector(selectors)` Returns the first element that is a descendant of
node that matches selectors.
`node . querySelectorAll(selectors)` Returns all element descendants of node that match
selectors.
The `children` getter steps are to return an
`HTMLCollection` collection rooted at [this](https://webidl.spec.whatwg.org/#this) matching only element children.
The `firstElementChild` getter steps are to return
the first child that is an element; otherwise null.
The `lastElementChild` getter steps are to return
the last child that is an element; otherwise null.
The `childElementCount` getter steps are to return
the number of children of [this](https://webidl.spec.whatwg.org/#this) that are elements.
The `prepend(nodes)` method steps are:
1. Let node be the result of converting nodes into a node given
nodes and [this](https://webidl.spec.whatwg.org/#this)’s node document.
2. Pre-insert node into [this](https://webidl.spec.whatwg.org/#this) before [this](https://webidl.spec.whatwg.org/#this)’s
first child.
The `append(nodes)` method steps are:
1. Let node be the result of converting nodes into a node given
nodes and [this](https://webidl.spec.whatwg.org/#this)’s node document.
2. Append node to [this](https://webidl.spec.whatwg.org/#this).
The `replaceChildren(nodes)` method steps
are:
1. Let node be the result of converting nodes into a node given
nodes and [this](https://webidl.spec.whatwg.org/#this)’s node document.
2. Ensure pre-insert validity given node, [this](https://webidl.spec.whatwg.org/#this), null, and
[this](https://webidl.spec.whatwg.org/#this)’s children.
3. Replace all with node within [this](https://webidl.spec.whatwg.org/#this).
The `moveBefore(node, child)`
method steps are:
1. Let referenceChild be child.
2. If referenceChild is node, then set referenceChild to
node’s next sibling.
3. Move node into [this](https://webidl.spec.whatwg.org/#this) before referenceChild.
The `querySelector(selectors)` method
steps are to return the first result of running scope-match a selectors string selectors against [this](https://webidl.spec.whatwg.org/#this), if the result is not an empty list; otherwise null.
The `querySelectorAll(selectors)` method
steps are to return the static result of running
scope-match a selectors string selectors against [this](https://webidl.spec.whatwg.org/#this).
#### 4.2.7. Mixin `NonDocumentTypeChildNode`
Web compatibility prevents the `previousElementSibling` and
`nextElementSibling` attributes from being exposed on doctypes (and therefore on
`ChildNode`).
```
interface mixin NonDocumentTypeChildNode {
readonly attribute Element? previousElementSibling;
readonly attribute Element? nextElementSibling;
};
Element includes NonDocumentTypeChildNode;
CharacterData includes NonDocumentTypeChildNode;
```
`element = node . `previousElementSibling`` Returns the first preceding sibling that is an element;
otherwise null.
`element = node . `nextElementSibling`` Returns the first following sibling that is an element;
otherwise null.
The `previousElementSibling` getter
steps are to return the first preceding sibling that is an
element; otherwise null.
The `nextElementSibling` getter
steps are to return the first following sibling that is an
element; otherwise null.
#### 4.2.8. Mixin `ChildNode`
```
interface mixin ChildNode {
[CEReactions, Unscopable] undefined before((Node or DOMString)... nodes);
[CEReactions, Unscopable] undefined after((Node or DOMString)... nodes);
[CEReactions, Unscopable] undefined replaceWith((Node or DOMString)... nodes);
[CEReactions, Unscopable] undefined remove();
};
DocumentType includes ChildNode;
Element includes ChildNode;
CharacterData includes ChildNode;
```
`node . `before(...nodes)`` Inserts nodes just before node, while replacing strings in
nodes with equivalent `Text` nodes.
[Throws](https://webidl.spec.whatwg.org/#dfn-throw) a "`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)` if the constraints of
the node tree are violated.
`node . `after(...nodes)`` Inserts nodes just after node, while replacing strings in
nodes with equivalent `Text` nodes.
[Throws](https://webidl.spec.whatwg.org/#dfn-throw) a "`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)` if the constraints of
the node tree are violated.
`node . `replaceWith(...nodes)`` Replaces node with nodes, while replacing strings in nodes
with equivalent `Text` nodes.
[Throws](https://webidl.spec.whatwg.org/#dfn-throw) a "`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)` if the constraints of
the node tree are violated.
`node . `remove()`` Removes node.
The `before(nodes)` method steps are:
1. Let parent be [this](https://webidl.spec.whatwg.org/#this)’s parent.
2. If parent is null, then return.
3. Let viablePreviousSibling be [this](https://webidl.spec.whatwg.org/#this)’s first preceding sibling not in nodes; otherwise null.
4. Let node be the result of converting nodes into a node, given
nodes and [this](https://webidl.spec.whatwg.org/#this)’s node document.
5. If viablePreviousSibling is null, then set it to parent’s
first child; otherwise to viablePreviousSibling’s
next sibling.
6. Pre-insert node into parent before
viablePreviousSibling.
The `after(nodes)` method steps are:
1. Let parent be [this](https://webidl.spec.whatwg.org/#this)’s parent.
2. If parent is null, then return.
3. Let viableNextSibling be [this](https://webidl.spec.whatwg.org/#this)’s first following sibling not in nodes; otherwise null.
4. Let node be the result of converting nodes into a node, given
nodes and [this](https://webidl.spec.whatwg.org/#this)’s node document.
5. Pre-insert node into parent before
viableNextSibling.
The `replaceWith(nodes)` method steps are:
1. Let parent be [this](https://webidl.spec.whatwg.org/#this)’s parent.
2. If parent is null, then return.
3. Let viableNextSibling be [this](https://webidl.spec.whatwg.org/#this)’s first following sibling not in nodes; otherwise null.
4. Let node be the result of converting nodes into a node, given
nodes and [this](https://webidl.spec.whatwg.org/#this)’s node document.
5. If [this](https://webidl.spec.whatwg.org/#this)’s parent is parent, replace [this](https://webidl.spec.whatwg.org/#this) with
node within parent. [This](https://webidl.spec.whatwg.org/#this) could have been inserted into node.
6. Otherwise, pre-insert node into parent before
viableNextSibling.
The `remove()` method steps are:
1. If [this](https://webidl.spec.whatwg.org/#this)’s parent is null, then return.
2. Remove [this](https://webidl.spec.whatwg.org/#this).
#### 4.2.9. Mixin `Slottable`
```
interface mixin Slottable {
readonly attribute HTMLSlotElement? assignedSlot;
};
Element includes Slottable;
Text includes Slottable;
```
The `assignedSlot`
getter steps are to return the result of find a slot given [this](https://webidl.spec.whatwg.org/#this) and true.
#### 4.2.10. Old-style collections: `NodeList` and `HTMLCollection`
A collection is an object that represents a list of
nodes. A collection can be either
live
or static.
Unless otherwise stated, a collection must be live.
If a collection is live, then the attributes and methods
on that object must operate on the actual underlying data, not a snapshot of
the data.
When a collection is created, a
filter and a root are associated with it.
The collection then
represents
a view of the subtree rooted at the collection’s root, containing only nodes that match the
given filter. The view is linear. In the absence of specific requirements to the contrary, the nodes
within the collection must be sorted in tree order.
##### 4.2.10.1. Interface `NodeList`
A `NodeList` object is a collection of nodes.
```
[Exposed=Window]
interface NodeList {
getter Node? item(unsigned long index);
readonly attribute unsigned long length;
iterable;
};
```
collection . `length` Returns the number of nodes in the collection.
element = collection . `item(index)`
element = collection[index]
Returns the node with index index from the collection. The
nodes are sorted in tree order.
The object’s [supported property indices](https://webidl.spec.whatwg.org/#dfn-supported-property-indices) are the numbers in the range zero to one less than
the number of nodes represented by the collection. If there are no such
elements, then there are no [supported property indices](https://webidl.spec.whatwg.org/#dfn-supported-property-indices).
The `length` attribute must return the number of nodes
represented by the collection.
The `item(index)` method must return the
indexth node in the collection. If there is no
indexth node in the collection, then the method must
return null.
##### 4.2.10.2. Interface `HTMLCollection`
```
[Exposed=Window, LegacyUnenumerableNamedProperties]
interface HTMLCollection {
readonly attribute unsigned long length;
getter Element? item(unsigned long index);
getter Element? namedItem(DOMString name);
};
```
An `HTMLCollection` object is a collection of elements.
`HTMLCollection` is a historical artifact we cannot rid the web of.
While developers are of course welcome to keep using it, new API standard designers ought not to use
it (use `sequence` in IDL instead).
collection . `length`
Returns the number of elements in
the collection.
element = collection . `item(index)`
element = collection[index]
Returns the element with index
index from the collection.
The elements are sorted in tree order.
element = collection . `namedItem(name)`
element = collection[name]
Returns the first element with ID or name name
from the collection.
The object’s [supported property indices](https://webidl.spec.whatwg.org/#dfn-supported-property-indices) are the numbers in the range zero to one less than
the number of elements represented by the collection. If there are no such
elements, then there are no [supported property indices](https://webidl.spec.whatwg.org/#dfn-supported-property-indices).
The `length` getter steps are to return the
number of nodes represented by the collection.
The `item(index)` method steps are to
return the indexth element in the collection. If there
is no indexth element in the collection, then the method
must return null.
The [supported property names](https://webidl.spec.whatwg.org/#dfn-supported-property-names) are the values from the list returned by these steps:
1. Let result be an empty list.
2. For each element represented by the collection, in
tree order:
1. If element has an ID which is not in result,
append element’s ID to result.
2. If element is in the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace) and has
a `name` attribute whose value is neither
the empty string nor is in result, append element’s
`name` attribute value to
result.
3. Return result.
The `namedItem(key)` method steps are:
1. If key is the empty string, return null.
2. Return the first element in the collection for which at least one of
the following is true: or null if there is no such element.
- it has an ID which is key ;
- it is in the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace) and has a `name` attribute whose value is key ;
### 4.3. Mutation observers
Each [similar-origin window agent](https://html.spec.whatwg.org/multipage/webappapis.html#similar-origin-window-agent) has a
mutation observer microtask queued
(a boolean), which is initially false. [HTML]
Each [similar-origin window agent](https://html.spec.whatwg.org/multipage/webappapis.html#similar-origin-window-agent) also has
pending mutation observers (a [set](https://infra.spec.whatwg.org/#ordered-set) of zero or more
`MutationObserver` objects), which is initially empty.
To
queue a mutation observer microtask:
1. If the [surrounding agent](https://tc39.es/ecma262/#surrounding-agent)’s mutation observer microtask queued is true, then
return.
2. Set the [surrounding agent](https://tc39.es/ecma262/#surrounding-agent)’s mutation observer microtask queued to true.
3. [Queue](https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-microtask) a [microtask](https://html.spec.whatwg.org/multipage/webappapis.html#microtask) to notify mutation observers.
To notify mutation observers:
1. Set the [surrounding agent](https://tc39.es/ecma262/#surrounding-agent)’s mutation observer microtask queued to false.
2. Let notifySet be a [clone](https://infra.spec.whatwg.org/#list-clone) of the [surrounding agent](https://tc39.es/ecma262/#surrounding-agent)’s
pending mutation observers.
3. [Empty](https://infra.spec.whatwg.org/#list-empty) the [surrounding agent](https://tc39.es/ecma262/#surrounding-agent)’s pending mutation observers.
4. Let signalSet be a [clone](https://infra.spec.whatwg.org/#list-clone) of the [surrounding agent](https://tc39.es/ecma262/#surrounding-agent)’s
signal slots.
5. [Empty](https://infra.spec.whatwg.org/#list-empty) the [surrounding agent](https://tc39.es/ecma262/#surrounding-agent)’s signal slots.
6. [For each](https://infra.spec.whatwg.org/#list-iterate) mo of notifySet:
1. Let records be a [clone](https://infra.spec.whatwg.org/#list-clone) of mo’s
record queue.
2. [Empty](https://infra.spec.whatwg.org/#list-empty) mo’s record queue.
3. [For each](https://infra.spec.whatwg.org/#list-iterate) node of mo’s
node list: [remove](https://infra.spec.whatwg.org/#list-remove) all
transient registered observers whose observer is
mo from node’s registered observer list.
4. If records [is not empty](https://infra.spec.whatwg.org/#list-is-empty), then [invoke](https://webidl.spec.whatwg.org/#invoke-a-callback-function) mo’s callback with « records, mo »
and "`report`", and with [callback this value](https://webidl.spec.whatwg.org/#dfn-callback-this-value) mo.
7. [For each](https://infra.spec.whatwg.org/#list-iterate) slot of signalSet: fire an event named
`slotchange`, with its `bubbles` attribute set to true,
at slot.
---
Each node has a registered observer list (a [list](https://infra.spec.whatwg.org/#list) of
zero or more registered observers), which is initially empty.
A registered observer consists of an
observer (a `MutationObserver` object) and
options (a `MutationObserverInit` dictionary).
A transient registered observer is a
registered observer that also consists of a
source (a registered observer).
Transient registered observers are used to track mutations within
a given node’s descendants after node has been removed so
they do not get lost when `subtree` is set to true on node’s
parent.
#### 4.3.1. Interface `MutationObserver`
```
[Exposed=Window]
interface MutationObserver {
constructor(MutationCallback callback);
undefined observe(Node target, optional MutationObserverInit options = {});
undefined disconnect();
sequence takeRecords();
};
callback MutationCallback = undefined (sequence mutations, MutationObserver observer);
dictionary MutationObserverInit {
boolean childList = false;
boolean attributes;
boolean characterData;
boolean subtree = false;
boolean attributeOldValue;
boolean characterDataOldValue;
sequence attributeFilter;
};
```
A `MutationObserver` object can be used to observe mutations to the tree of
nodes.
Each `MutationObserver` object has these associated concepts:
- A callback set on creation.
- A node list (a [list](https://infra.spec.whatwg.org/#list) of weak references to nodes ), which is initially empty.
- A record queue (a [queue](https://infra.spec.whatwg.org/#queue) of
zero or more `MutationRecord` objects), which is initially empty.
`observer = new `MutationObserver(callback)`` Constructs a `MutationObserver` object and sets its callback to
callback. The callback is invoked with a list of `MutationRecord` objects
as first argument and the constructed `MutationObserver` object as second argument. It is
invoked after nodes registered with the `observe()` method, are
mutated.
`observer . `observe(target, options)``
Instructs the user agent to observe a given target
(a node) and report any mutations based on
the criteria given by options (an object).
The options argument allows for setting mutation
observation options via object members. These are the object members that
can be used:
`childList` Set to true if mutations to target’s children are to be observed.
`attributes` Set to true if mutations to target’s
attributes are to be observed. Can be omitted if
`attributeOldValue` or
`attributeFilter` is
specified.
`characterData` Set to true if mutations to target’s
data are to be observed. Can be omitted if
`characterDataOldValue`
is specified.
`subtree` Set to true if mutations to not just target, but
also target’s
descendants are to be
observed.
`attributeOldValue` Set to true if
`attributes` is true or omitted
and target’s
attribute value before the mutation
needs to be recorded.
`characterDataOldValue` Set to true if
`characterData`
is set to true or omitted and target’s
data before the mutation
needs to be recorded.
`attributeFilter` Set to a list of attribute local names (without namespace) if not all
attribute mutations need to be
observed and `attributes` is true
or omitted.
`observer . `disconnect()`` Stops observer from observing any mutations. Until the `observe()` method is used
again, observer’s callback will not be invoked.
`observer . `takeRecords()`` Empties the record queue and
returns what was in there.
The
`new MutationObserver(callback)`
constructor steps are to set [this](https://webidl.spec.whatwg.org/#this)’s callback to
callback.
The
`observe(target, options)`
method steps are:
If either options["`attributeOldValue`"] or
options["`attributeFilter`"] [exists](https://infra.spec.whatwg.org/#map-exists), and
options["`attributes`"] does not [exist](https://infra.spec.whatwg.org/#map-exists), then set
options["`attributes`"] to true.
If options["`characterDataOldValue`"]
[exists](https://infra.spec.whatwg.org/#map-exists) and options["`characterData`"] does not
[exist](https://infra.spec.whatwg.org/#map-exists), then set options["`characterData`"] to
true.
If none of options["`childList`"],
options["`attributes`"], and
options["`characterData`"] is true, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a
`TypeError`.
If options["`attributeOldValue`"] is true and
options["`attributes`"] is false, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a
`TypeError`.
If options["`attributeFilter`"] [exists](https://infra.spec.whatwg.org/#map-exists) and
options["`attributes`"] is false, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a
`TypeError`.
If options["`characterDataOldValue`"] is true and
options["`characterData`"] is false, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a
`TypeError`.
[For each](https://infra.spec.whatwg.org/#list-iterate) registered of target’s
registered observer list: if registered’s
observer is [this](https://webidl.spec.whatwg.org/#this):
[For each](https://infra.spec.whatwg.org/#list-iterate) node of [this](https://webidl.spec.whatwg.org/#this)’s
node list: [remove](https://infra.spec.whatwg.org/#list-remove) all
transient registered observers whose source is
registered from node’s registered observer list.
Set registered’s options to
options.
Otherwise:
[Append](https://infra.spec.whatwg.org/#list-append) a new registered observer whose
observer is [this](https://webidl.spec.whatwg.org/#this) and
options is options to target’s
registered observer list.
[Append](https://infra.spec.whatwg.org/#list-append) a weak reference to target to [this](https://webidl.spec.whatwg.org/#this)’s
node list.
The `disconnect()` method steps are:
[For each](https://infra.spec.whatwg.org/#list-iterate) node of [this](https://webidl.spec.whatwg.org/#this)’s
node list: [remove](https://infra.spec.whatwg.org/#list-remove) any registered observer from
node’s registered observer list for which [this](https://webidl.spec.whatwg.org/#this) is the
observer.
[Empty](https://infra.spec.whatwg.org/#list-empty) [this](https://webidl.spec.whatwg.org/#this)’s record queue.
The `takeRecords()` method steps are:
Let records be a [clone](https://infra.spec.whatwg.org/#list-clone) of [this](https://webidl.spec.whatwg.org/#this)’s
record queue.
[Empty](https://infra.spec.whatwg.org/#list-empty) [this](https://webidl.spec.whatwg.org/#this)’s record queue.
Return records.
4.3.2. Queuing a mutation record To queue a mutation record of type for target with
name, namespace, oldValue, addedNodes,
removedNodes, previousSibling, and nextSibling:
Let interestedObservers be an empty [map](https://infra.spec.whatwg.org/#ordered-map).
Let nodes be the inclusive ancestors of target.
For each node of nodes, and then [for each](https://infra.spec.whatwg.org/#list-iterate) registered of node’s registered observer list:
Let options be registered’s
options.
If none of the following are true
node is not target and
options["`subtree`"] is false
type is "`attributes`" and
options["`attributes`"] either does not [exist](https://infra.spec.whatwg.org/#map-exists)
or is false
type is "`attributes`",
options["`attributeFilter`"] [exists](https://infra.spec.whatwg.org/#map-exists), and
options["`attributeFilter`"] does not [contain](https://infra.spec.whatwg.org/#list-contain) name or namespace is non-null
type is "`characterData`" and
options["`characterData`"] either does not
[exist](https://infra.spec.whatwg.org/#map-exists) or is false
type is "`childList`" and
options["`childList`"] is false
then:
Let mo be registered’s observer.
If interestedObservers[mo] does not [exist](https://infra.spec.whatwg.org/#map-exists), then
[set](https://infra.spec.whatwg.org/#map-set) interestedObservers[mo] to null.
If either type is "`attributes`" and
options["`attributeOldValue`"] is true, or type is
"`characterData`" and
options["`characterDataOldValue`"] is true, then
[set](https://infra.spec.whatwg.org/#map-set) interestedObservers[mo] to oldValue.
[For each](https://infra.spec.whatwg.org/#map-iterate) observer → mappedOldValue of
interestedObservers:
Let record be a new `MutationRecord` object with its `type`
set to type, `target` set to target,
`attributeName` set to name, `attributeNamespace`
set to namespace, `oldValue` set to mappedOldValue,
`addedNodes` set to addedNodes,
`removedNodes` set to removedNodes,
`previousSibling` set to previousSibling, and
`nextSibling` set to nextSibling.
[Enqueue](https://infra.spec.whatwg.org/#queue-enqueue) record to observer’s
record queue.
[Append](https://infra.spec.whatwg.org/#set-append) observer to the [surrounding agent](https://tc39.es/ecma262/#surrounding-agent)’s
pending mutation observers.
Queue a mutation observer microtask.
To queue a tree mutation record for target with addedNodes,
removedNodes, previousSibling, and nextSibling:
[Assert](https://infra.spec.whatwg.org/#assert): either addedNodes or removedNodes [is not empty](https://infra.spec.whatwg.org/#list-is-empty).
Queue a mutation record of "`childList`" for target with
null, null, null, addedNodes, removedNodes, previousSibling,
and nextSibling.
4.3.3. Interface `MutationRecord` [[Exposed](https://webidl.spec.whatwg.org/#Exposed)=Window]
interface `MutationRecord` {
readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) type;
[[SameObject](https://webidl.spec.whatwg.org/#SameObject)] readonly attribute Node target;
[[SameObject](https://webidl.spec.whatwg.org/#SameObject)] readonly attribute NodeList addedNodes;
[[SameObject](https://webidl.spec.whatwg.org/#SameObject)] readonly attribute NodeList removedNodes;
readonly attribute Node? previousSibling;
readonly attribute Node? nextSibling;
readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? attributeName;
readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? attributeNamespace;
readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? oldValue;
};
`record . `type`` Returns "`attributes`" if it was an
attribute mutation.
"`characterData`" if it was a mutation to a
`CharacterData` node. And
"`childList`" if it was a mutation to the
tree of
nodes.
`record . `target`` Returns the node the mutation
affected, depending on the `type`.
For "`attributes`", it is the
element whose
attribute changed. For
"`characterData`", it is the `CharacterData` node. For "`childList`",
it is the node whose
children changed.
`record . `addedNodes``
`record . `removedNodes`` Return the nodes added and removed
respectively.
`record . `previousSibling``
`record . `nextSibling`` Return the previous and next sibling respectively
of the added or removed nodes; otherwise null.
`record . `attributeName`` Returns the local name of the changed attribute; otherwise null.
`record . `attributeNamespace`` Returns the namespace of the changed attribute; otherwise null.
`record . `oldValue`` The return value depends on
`type`. For
"`attributes`", it is the
value of the
changed attribute before the change.
For "`characterData`", it is the
data of the changed
node before the change. For
"`childList`", it is null.
The `type`, `target`,
`addedNodes`,
`removedNodes`,
`previousSibling`,
`nextSibling`,
`attributeName`,
`attributeNamespace`, and
`oldValue` attributes must return the values they were
initialized to.
4.4. Interface `Node` [[Exposed](https://webidl.spec.whatwg.org/#Exposed)=Window]
interface `Node` : EventTarget {
const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) ELEMENT_NODE = 1;
const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) ATTRIBUTE_NODE = 2;
const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) TEXT_NODE = 3;
const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) CDATA_SECTION_NODE = 4;
const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `ENTITY_REFERENCE_NODE` = 5; // legacy
const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `ENTITY_NODE` = 6; // legacy
const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) PROCESSING_INSTRUCTION_NODE = 7;
const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) = 8;
const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) DOCUMENT_NODE = 9;
const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) DOCUMENT_TYPE_NODE = 10;
const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) DOCUMENT_FRAGMENT_NODE = 11;
const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `NOTATION_NODE` = 12; // legacy
readonly attribute [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) nodeType;
readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) nodeName;
readonly attribute [USVString](https://webidl.spec.whatwg.org/#idl-USVString) baseURI;
readonly attribute [boolean](https://webidl.spec.whatwg.org/#idl-boolean) isConnected;
readonly attribute Document? ownerDocument;
Node getRootNode(optional GetRootNodeOptions `options` = {});
readonly attribute Node? parentNode;
readonly attribute Element? parentElement;
[boolean](https://webidl.spec.whatwg.org/#idl-boolean) hasChildNodes();
[[SameObject](https://webidl.spec.whatwg.org/#SameObject)] readonly attribute NodeList childNodes;
readonly attribute Node? firstChild;
readonly attribute Node? lastChild;
readonly attribute Node? previousSibling;
readonly attribute Node? nextSibling;
[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)] attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? nodeValue;
[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)] attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? textContent;
[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) normalize();
[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions), [NewObject](https://webidl.spec.whatwg.org/#NewObject)] Node cloneNode(optional [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `subtree` = false);
[boolean](https://webidl.spec.whatwg.org/#idl-boolean) isEqualNode(Node? `otherNode`);
[boolean](https://webidl.spec.whatwg.org/#idl-boolean) isSameNode(Node? `otherNode`); // legacy alias of ===
const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) DOCUMENT_POSITION_DISCONNECTED = 0x01;
const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) DOCUMENT_POSITION_PRECEDING = 0x02;
const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) DOCUMENT_POSITION_FOLLOWING = 0x04;
const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) DOCUMENT_POSITION_CONTAINS = 0x08;
const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) DOCUMENT_POSITION_CONTAINED_BY = 0x10;
const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20;
[unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) compareDocumentPosition(Node `other`);
[boolean](https://webidl.spec.whatwg.org/#idl-boolean) contains(Node? `other`);
[DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? lookupPrefix([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`);
[DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? lookupNamespaceURI([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `prefix`);
[boolean](https://webidl.spec.whatwg.org/#idl-boolean) isDefaultNamespace([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`);
[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)] Node insertBefore(Node `node`, Node? `child`);
[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)] Node appendChild(Node `node`);
[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)] Node replaceChild(Node `node`, Node `child`);
[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)] Node removeChild(Node `child`);
};
dictionary `GetRootNodeOptions` {
[boolean](https://webidl.spec.whatwg.org/#idl-boolean) `composed` = false;
};
`Node` is an abstract interface that is used by all nodes. You cannot
get a direct instance of it.
Each node has an associated
node document, set upon creation, that is a
document.
A node’s node document can be changed by the
adopt algorithm.
A node’s get the parent algorithm, given an event, returns the
node’s assigned slot, if node is assigned; otherwise
node’s parent.
Each node also has a registered observer list.
To create a node that implements an interface interface, given a
document document:
[Assert](https://infra.spec.whatwg.org/#assert): interface is neither `Document` nor an interface that
inherits from `Document`. To create a document, use
create a document instead. Return a new node that [implements](https://webidl.spec.whatwg.org/#implements) interface, in
document’s [relevant realm](https://html.spec.whatwg.org/multipage/webappapis.html#concept-relevant-realm), with its node document set to
document.
`node . `nodeType`` Returns a number appropriate for the type of node, as follows:
`Element` ``Node` . `ELEMENT_NODE`` (1).
`Attr` ``Node` . `ATTRIBUTE_NODE`` (2).
An exclusive `Text` node ``Node` . `TEXT_NODE`` (3).
`CDATASection` ``Node` . `CDATA_SECTION_NODE`` (4).
`ProcessingInstruction` ``Node` . `PROCESSING_INSTRUCTION_NODE`` (7).
`Comment` ``Node` .` (8).
`Document` ``Node` . `DOCUMENT_NODE`` (9).
`DocumentType` ``Node` . `DOCUMENT_TYPE_NODE`` (10).
`DocumentFragment` ``Node` . `DOCUMENT_FRAGMENT_NODE`` (11).
`node . `nodeName`` Returns a string appropriate for the type of node, as follows:
`Element` Its HTML-uppercased qualified name.
`Attr` Its qualified name.
An exclusive `Text` node "`#text`".
`CDATASection` "`#cdata-section`".
`ProcessingInstruction` Its target.
`Comment` "`#comment`".
`Document` "`#document`".
`DocumentType` Its name.
`DocumentFragment` "`#document-fragment`".
The `nodeType` getter steps are to return the first matching
statement, switching on the interface [this](https://webidl.spec.whatwg.org/#this) [implements](https://webidl.spec.whatwg.org/#implements):
`Element` `ELEMENT_NODE` (1)
`Attr` `ATTRIBUTE_NODE` (2);
An exclusive `Text` node `TEXT_NODE` (3);
`CDATASection` `CDATA_SECTION_NODE` (4);
`ProcessingInstruction` `PROCESSING_INSTRUCTION_NODE` (7);
`Comment` (8);
`Document` `DOCUMENT_NODE` (9);
`DocumentType` `DOCUMENT_TYPE_NODE` (10);
`DocumentFragment` `DOCUMENT_FRAGMENT_NODE` (11).
The `nodeName` getter steps are to return the first matching
statement, switching on the interface [this](https://webidl.spec.whatwg.org/#this) [implements](https://webidl.spec.whatwg.org/#implements):
`Element` Its HTML-uppercased qualified name.
`Attr` Its qualified name.
An exclusive `Text` node "`#text`".
`CDATASection` "`#cdata-section`".
`ProcessingInstruction` Its target.
`Comment` "`#comment`".
`Document` "`#document`".
`DocumentType` Its name.
`DocumentFragment` "`#document-fragment`".
`node . `baseURI`` Returns node’s node document’s [document base URL](https://html.spec.whatwg.org/multipage/urls-and-fetching.html#document-base-url).
The `baseURI` getter steps are to return [this](https://webidl.spec.whatwg.org/#this)’s
node document’s [document base URL](https://html.spec.whatwg.org/multipage/urls-and-fetching.html#document-base-url), [serialized](https://url.spec.whatwg.org/#concept-url-serializer).
`node . `isConnected`` Returns true if node is connected; otherwise false.
`node . `ownerDocument``
Returns the node document.
Returns null for documents.
`node . `getRootNode()`` Returns node’s root.
`node . getRootNode({ composed:true })` Returns node’s shadow-including root.
`node . `parentNode`` Returns the parent.
`node . `parentElement`` Returns the parent element.
`node . `hasChildNodes()`` Returns whether node has
children.
`node . `childNodes`` Returns the children.
`node . `firstChild`` Returns the first child.
`node . `lastChild`` Returns the last child.
`node . `previousSibling`` Returns the
previous sibling.
`node . `nextSibling`` Returns the
next sibling.
The `isConnected` getter steps are to return true,
if [this](https://webidl.spec.whatwg.org/#this) is connected; otherwise false.
The `ownerDocument` getter steps are to return null,
if [this](https://webidl.spec.whatwg.org/#this) is a document; otherwise [this](https://webidl.spec.whatwg.org/#this)’s node document.
The node document of a document is that
document itself. All nodes have a node document at all
times.
The `getRootNode(options)` method steps are to
return [this](https://webidl.spec.whatwg.org/#this)’s shadow-including root if
options["`composed`"] is true; otherwise [this](https://webidl.spec.whatwg.org/#this)’s
root.
The `parentNode` getter steps are to return
[this](https://webidl.spec.whatwg.org/#this)’s parent.
The `parentElement` getter steps are to return
[this](https://webidl.spec.whatwg.org/#this)’s parent element.
The `hasChildNodes()` method steps are to return true if
[this](https://webidl.spec.whatwg.org/#this) has children; otherwise false.
The `childNodes` getter steps are to return a
`NodeList` rooted at [this](https://webidl.spec.whatwg.org/#this) matching only children.
The `firstChild` getter steps are to return
[this](https://webidl.spec.whatwg.org/#this)’s first child.
The `lastChild` getter steps are to return [this](https://webidl.spec.whatwg.org/#this)’s
last child.
The `previousSibling` getter steps are to return
[this](https://webidl.spec.whatwg.org/#this)’s previous sibling.
The `nextSibling` getter steps are to return
[this](https://webidl.spec.whatwg.org/#this)’s next sibling.
The `nodeValue` getter steps are to return the following, switching
on the interface [this](https://webidl.spec.whatwg.org/#this) [implements](https://webidl.spec.whatwg.org/#implements):
`Attr` [this](https://webidl.spec.whatwg.org/#this)’s value.
`CharacterData` [this](https://webidl.spec.whatwg.org/#this)’s data.
Otherwise
Null.
The `nodeValue` setter steps are to, if the given value is null, act as if it was the
empty string instead, and then do as described below, switching on the interface [this](https://webidl.spec.whatwg.org/#this) [implements](https://webidl.spec.whatwg.org/#implements):
`Attr` Set an existing attribute value with [this](https://webidl.spec.whatwg.org/#this) and the given value.
`CharacterData` Replace data of [this](https://webidl.spec.whatwg.org/#this) with 0, [this](https://webidl.spec.whatwg.org/#this)’s length, and
the given value.
Otherwise
Do nothing.
To get text content with a node node,
return the following, switching on the interface node [implements](https://webidl.spec.whatwg.org/#implements):
`DocumentFragment`
`Element` The descendant text content of node.
`Attr` node’s value.
`CharacterData` node’s data.
Otherwise
Null.
The `textContent` getter steps are to
return the result of running get text content with [this](https://webidl.spec.whatwg.org/#this).
To string replace all with a string string within a
node parent, run these steps:
Let node be null.
If string is not the empty string, then set node to the result of
creating a text node given parent’s node document and
string.
Replace all with node within parent.
To set text content with a node node and a string value,
do as defined below, switching on the interface node [implements](https://webidl.spec.whatwg.org/#implements):
`DocumentFragment`
`Element` String replace all with value within node.
`Attr` Set an existing attribute value with node and value.
`CharacterData` Replace data of node with 0, node’s length, and
value.
Otherwise
Do nothing.
The `textContent` setter steps are to, if the given value is null, act as if it was the
empty string instead, and then run set text content with [this](https://webidl.spec.whatwg.org/#this) and the given value.
`node . `normalize()`` Removes empty exclusive `Text` nodes and concatenates the
data of remaining contiguous exclusive `Text` nodes
into the first of their nodes.
The `normalize()` method steps are to run these steps for
each descendant exclusive `Text` node node of
[this](https://webidl.spec.whatwg.org/#this):
Let length be node’s length.
If length is zero, then remove node and continue with the
next exclusive `Text` node, if any.
Let data be the [concatenation](https://infra.spec.whatwg.org/#string-concatenate) of the
data of node’s
contiguous exclusive `Text` nodes (excluding itself), in tree order.
Replace data of node with length, 0, and data.
Let currentNode be node’s next sibling.
While currentNode is an exclusive `Text` node:
For each live range whose start node is currentNode:
add length to its start offset and set its
start node to node.
For each live range whose end node is currentNode: add
length to its end offset and set its end node to
node.
For each live range whose start node is currentNode’s
parent and start offset is currentNode’s
index: set its start node to node and its
start offset to length.
For each live range whose end node is currentNode’s
parent and end offset is currentNode’s
index: set its end node to node and its
end offset to length.
Add currentNode’s length to length.
Set currentNode to its next sibling.
Remove node’s contiguous exclusive `Text` nodes
(excluding itself), in tree order.
`node . cloneNode([subtree = false])` Returns a copy of node. If
subtree is true, the copy also includes the
node’s descendants.
`node . isEqualNode(otherNode)` Returns whether node and otherNode
have the same properties.
Specifications may define
cloning steps for all or some nodes. The
algorithm is passed node, copy, and subtree as
indicated in the clone a node algorithm.
HTML defines cloning steps for several elements, such as `[input](https://html.spec.whatwg.org/multipage/input.html#the-input-element)`, `[script](https://html.spec.whatwg.org/multipage/scripting.html#script)`,
and `[template](https://html.spec.whatwg.org/multipage/scripting.html#the-template-element)`. SVG ought to do the same for its `[script](https://html.spec.whatwg.org/multipage/scripting.html#script)` elements, but does not.
To clone a node given a node node
and an optional document document
(default node’s node document), boolean
subtree (default false), node-or-null
parent (default null), and null or a
`[CustomElementRegistry](https://html.spec.whatwg.org/multipage/custom-elements.html#customelementregistry)` object fallbackRegistry
(default null):
[Assert](https://infra.spec.whatwg.org/#assert): node is not a document or node is
document.
Let copy be the result of cloning a single node given node,
document, and fallbackRegistry.
Run any cloning steps defined for node in
other applicable specifications and pass node, copy, and
subtree as parameters.
If parent is non-null, then append copy to
parent.
If subtree is true, then for each child of node’s
children, in tree order: clone a node given child with
*document* set to document,
*subtree* set to subtree,
*parent* set to copy, and
*fallbackRegistry* set to fallbackRegistry.
If node is an element, node is a
shadow host, and node’s shadow root’s
clonable is true:
[Assert](https://infra.spec.whatwg.org/#assert): copy is not a shadow host.
Let shadowRootRegistry be node’s shadow root’s
custom element registry.
If shadowRootRegistry is a global custom element registry, then set
shadowRootRegistry to document’s
custom element registry’s effective global custom element registry.
Attach a shadow root with copy, node’s
shadow root’s mode, node’s
shadow root’s delegates focus, node’s
shadow root’s serializable, node’s
shadow root’s slot assignment, true, and
shadowRootRegistry.
Set copy’s shadow root’s declarative
to node’s shadow root’s declarative.
Set copy’s shadow root’s
keep custom element registry null to node’s
shadow root’s keep custom element registry null.
For each child of node’s shadow root’s
children, in tree order: clone a node given child with
*document* set to document,
*subtree* set to true, and
*parent* set to copy’s shadow root.
This intentionally does not pass the
*fallbackRegistry* argument.
Return copy.
To clone a single node given a node node,
document document, and null or a `[CustomElementRegistry](https://html.spec.whatwg.org/multipage/custom-elements.html#customelementregistry)` object
fallbackRegistry:
Let copy be null.
If node is an element:
Let registry be node’s custom element registry.
If registry is null, then set registry to
fallbackRegistry.
If registry is a global custom element registry, then set
registry to document’s custom element registry’s
effective global custom element registry.
Set copy to the result of creating an element, given
document, node’s local name, node’s
namespace, node’s namespace prefix,
node’s `is` value, false, and registry.
[For each](https://infra.spec.whatwg.org/#list-iterate) attribute of node’s
attribute list:
Let copyAttribute be the result of cloning a single node given
attribute, document, and null.
Append copyAttribute to copy.
Otherwise, if node is a document, set copy to the result
of creating a document that implements the same interfaces as node, given
document’s [relevant realm](https://html.spec.whatwg.org/multipage/webappapis.html#concept-relevant-realm).
Otherwise, set copy to the result of creating a node that
[implements](https://webidl.spec.whatwg.org/#implements) the same interfaces as node, given document.
Fulfill these additional requirements, switching on the interface node [implements](https://webidl.spec.whatwg.org/#implements):
`Document` Set copy’s encoding, content type,
URL, origin, type,
mode, and allow declarative shadow roots, to those of
node.
If node’s custom element registry’s
[is scoped](https://html.spec.whatwg.org/multipage/custom-elements.html#is-scoped) is true, then set copy’s
custom element registry to node’s
custom element registry.
`DocumentType` Set copy’s name, public ID, and
system ID to those of node.
`Attr` Set copy’s namespace, namespace prefix,
local name, and value to those of node.
`Text` `Comment` Set copy’s data to that of node.
`ProcessingInstruction` Set copy’s target and
data to those of node.
Otherwise
Do nothing.
[Assert](https://infra.spec.whatwg.org/#assert): copy is a node.
If node is a document, then set document to
copy.
Set copy’s node document to document.
Return copy.
The `cloneNode(subtree)` method steps are:
If [this](https://webidl.spec.whatwg.org/#this) is a shadow root, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a
"`[NotSupportedError](https://webidl.spec.whatwg.org/#notsupportederror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
Return the result of cloning a node given [this](https://webidl.spec.whatwg.org/#this) with
*subtree* set to subtree.
A node A equals a
node B if all of the following conditions are true:
A and B [implement](https://webidl.spec.whatwg.org/#implements) the same interfaces.
The following are equal, switching on the interface A [implements](https://webidl.spec.whatwg.org/#implements):
`DocumentType` Its name, public ID, and system ID.
`Element` Its namespace, namespace prefix,
local name, and its attribute list’s [size](https://infra.spec.whatwg.org/#list-size).
`Attr` Its namespace, local name, and value.
`ProcessingInstruction` Its target and data.
`Text` `Comment` Its data.
Otherwise
—
If A is an element, each attribute in its
attribute list equals an attribute in B’s
attribute list.
A and B have the same number of children.
Each child of A equals the child
of B at the identical index.
The `isEqualNode(otherNode)` method steps are to
return true if otherNode is non-null and [this](https://webidl.spec.whatwg.org/#this) equals otherNode; otherwise false.
The `isSameNode(otherNode)` method steps are to
return true if otherNode is [this](https://webidl.spec.whatwg.org/#this); otherwise false.
`node . `compareDocumentPosition(other)``
Returns a bitmask indicating the position of other
relative to node. These are the bits that can be set:
``Node` . `DOCUMENT_POSITION_DISCONNECTED`` (1)
Set when node and other are not in the
same tree.
``Node` . `DOCUMENT_POSITION_PRECEDING`` (2)
Set when other is
preceding node.
``Node` . `DOCUMENT_POSITION_FOLLOWING`` (4)
Set when other is
following node.
``Node` . `DOCUMENT_POSITION_CONTAINS`` (8)
Set when other is an ancestor of node.
``Node` . `DOCUMENT_POSITION_CONTAINED_BY`` (16, 10 in hexadecimal)
Set when other is a descendant of node.
`node . `contains(other)`` Returns true if other is an inclusive descendant of node;
otherwise false.
These are the constants `compareDocumentPosition()` returns as mask:
`DOCUMENT_POSITION_DISCONNECTED` (1);
`DOCUMENT_POSITION_PRECEDING` (2);
`DOCUMENT_POSITION_FOLLOWING` (4);
`DOCUMENT_POSITION_CONTAINS` (8);
`DOCUMENT_POSITION_CONTAINED_BY` (16, 10 in hexadecimal);
`DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC` (32, 20 in hexadecimal).
The `compareDocumentPosition(other)` method
steps are:
If [this](https://webidl.spec.whatwg.org/#this) is other, then return zero.
Let node1 be other and node2 be [this](https://webidl.spec.whatwg.org/#this).
Let attr1 and attr2 be null.
If node1 is an attribute, then set attr1 to node1
and node1 to attr1’s element.
If node2 is an attribute:
Set attr2 to node2 and node2 to attr2’s
element.
If attr1 and node1 are non-null, and node2 is
node1:
[For each](https://infra.spec.whatwg.org/#list-iterate) attr of node2’s
attribute list:
If attr equals attr1, then return the result of
adding `DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC` and
`DOCUMENT_POSITION_PRECEDING`.
If attr equals attr2, then return the result of
adding `DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC` and
`DOCUMENT_POSITION_FOLLOWING`.
If node1 or node2 is null, or node1’s root is
not node2’s root, then return the result of adding
`DOCUMENT_POSITION_DISCONNECTED`, `DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC`, and
either `DOCUMENT_POSITION_PRECEDING` or `DOCUMENT_POSITION_FOLLOWING`, with the
constraint that this is to be consistent, together.
Whether to return `DOCUMENT_POSITION_PRECEDING` or
`DOCUMENT_POSITION_FOLLOWING` is typically implemented via pointer comparison. In
JavaScript implementations a cached `Math.random()` value can
be used.
If node1 is an ancestor of node2 and attr1
is null, or node1 is node2 and attr2 is non-null, then return the
result of adding `DOCUMENT_POSITION_CONTAINS` to `DOCUMENT_POSITION_PRECEDING`.
If node1 is a descendant of node2 and attr2
is null, or node1 is node2 and attr1 is non-null, then return the
result of adding `DOCUMENT_POSITION_CONTAINED_BY` to `DOCUMENT_POSITION_FOLLOWING`.
If node1 is preceding node2, then return
`DOCUMENT_POSITION_PRECEDING`.
Due to the way attributes are handled in this algorithm this results in a
node’s attributes counting as preceding that node’s
children, despite attributes not participating in the same
tree.
Return `DOCUMENT_POSITION_FOLLOWING`.
The `contains(other)` method steps are to return
true if other is an inclusive descendant of [this](https://webidl.spec.whatwg.org/#this); otherwise false
(including when other is null).
To
locate a namespace prefix
for an element using namespace, run these steps:
If element’s namespace is namespace and its
namespace prefix is non-null, then return its
namespace prefix.
If element has an attribute whose
namespace prefix is "`xmlns`" and value is
namespace, then return element’s first such attribute’s
local name.
If element’s parent element is non-null, then return the result of running
locate a namespace prefix on that element using namespace.
Return null.
To locate a namespace for a node using prefix, switch on
the interface node [implements](https://webidl.spec.whatwg.org/#implements):
`Element` If prefix is "`xml`", then return the [XML namespace](https://infra.spec.whatwg.org/#xml-namespace).
If prefix is "`xmlns`", then return the [XMLNS namespace](https://infra.spec.whatwg.org/#xmlns-namespace).
If its namespace is non-null and its
namespace prefix is prefix, then return
namespace.
If it has an attribute whose namespace
is the [XMLNS namespace](https://infra.spec.whatwg.org/#xmlns-namespace), namespace prefix is "`xmlns`", and
local name is prefix, or if prefix is null and it
has an attribute whose namespace is the
[XMLNS namespace](https://infra.spec.whatwg.org/#xmlns-namespace), namespace prefix is null, and local name
is "`xmlns`", then return its value if it is not the empty string, and
null otherwise.
If its parent element is null, then return null.
Return the result of running locate a namespace on its parent element using
prefix.
`Document` If its document element is null, then return null.
Return the result of running locate a namespace on its document element
using prefix.
`DocumentType`
`DocumentFragment` Return null.
`Attr` If its element is null, then return null.
Return the result of running locate a namespace on its element
using prefix.
Otherwise
If its parent element is null, then return null.
Return the result of running locate a namespace on its parent element using
prefix.
The `lookupPrefix(namespace)` method steps are:
If namespace is null or the empty string, then return null.
Switch on the interface [this](https://webidl.spec.whatwg.org/#this) [implements](https://webidl.spec.whatwg.org/#implements):
`Element` Return the result of locating a namespace prefix for [this](https://webidl.spec.whatwg.org/#this) using
namespace.
`Document` If [this](https://webidl.spec.whatwg.org/#this)’s document element is null, then return null.
Return the result of locating a namespace prefix for [this](https://webidl.spec.whatwg.org/#this)’s
document element using namespace.
`DocumentType` `DocumentFragment` Return null.
`Attr` If [this](https://webidl.spec.whatwg.org/#this)’s element is null, then return null.
Return the result of locating a namespace prefix for [this](https://webidl.spec.whatwg.org/#this)’s
element using namespace.
Otherwise
If [this](https://webidl.spec.whatwg.org/#this)’s parent element is null, then return null.
Return the result of locating a namespace prefix for [this](https://webidl.spec.whatwg.org/#this)’s
parent element using namespace.
The `lookupNamespaceURI(prefix)` method steps
are:
If prefix is the empty string, then set it to null.
Return the result of running locate a namespace for [this](https://webidl.spec.whatwg.org/#this) using
prefix.
The `isDefaultNamespace(namespace)` method steps
are:
If namespace is the empty string, then set it to null.
Let defaultNamespace be the result of running locate a namespace for
[this](https://webidl.spec.whatwg.org/#this) using null.
Return true if defaultNamespace is the same as namespace; otherwise
false.
The `insertBefore(node, child)`
method steps are to return the result of pre-inserting node into [this](https://webidl.spec.whatwg.org/#this)
before child.
The `appendChild(node)` method steps are to
return the result of appending node to [this](https://webidl.spec.whatwg.org/#this).
The `replaceChild(node, child)`
method steps are to return the result of replacing child with node
within [this](https://webidl.spec.whatwg.org/#this).
The `removeChild(child)` method steps are to
return the result of pre-removing child from [this](https://webidl.spec.whatwg.org/#this).
The
list of elements with qualified name qualifiedName
for a node root is the `HTMLCollection` returned by the following
algorithm:
If qualifiedName is U+002A (*), then return an `HTMLCollection` rooted at
root, whose filter matches only descendant elements.
Otherwise, if root’s node document is an HTML document,
return an `HTMLCollection` rooted at root, whose filter matches the following
descendant elements:
Whose namespace is the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace) and whose
qualified name is qualifiedName, in [ASCII lowercase](https://infra.spec.whatwg.org/#ascii-lowercase).
Whose namespace is *not* the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace) and whose
qualified name is qualifiedName.
Otherwise, return an `HTMLCollection` rooted at root, whose filter matches
descendant elements whose qualified name is
qualifiedName.
When invoked with the same argument, and as long as root’s
node document’s type has not changed, the same
`HTMLCollection` object may be returned as returned by an earlier call.
The
list of elements with namespace namespace and local name localName
for a node root is the `HTMLCollection` returned by the following
algorithm:
If namespace is the empty string, then set it to null.
If both namespace and localName are U+002A (*), then return an
`HTMLCollection` rooted at root, whose filter matches descendant elements.
If namespace is U+002A (*), then return an `HTMLCollection` rooted at
root, whose filter matches descendant elements whose
local name is localName.
If localName is U+002A (*), then return an `HTMLCollection` rooted at
root, whose filter matches descendant elements whose
namespace is namespace.
Return an `HTMLCollection` rooted at root, whose filter matches
descendant elements whose namespace is
namespace and local name is localName.
When invoked with the same arguments, the same `HTMLCollection` object may be returned as
returned by an earlier call.
The
list of elements with class names classNames
for a node root is the `HTMLCollection` returned by the following
algorithm:
Let classes be the result of running the
ordered set parser on
classNames.
If classes is the empty set, return an empty
`HTMLCollection`.
Return an `HTMLCollection` rooted at root, whose filter matches
descendant elements that have all their classes in
classes.
The comparisons for the classes must be done in an
[ASCII case-insensitive](https://infra.spec.whatwg.org/#ascii-case-insensitive) manner if root’s node document’s
mode is "`quirks`"; otherwise in an [identical to](https://infra.spec.whatwg.org/#string-is)
manner.
When invoked with the same argument, the same `HTMLCollection` object may be returned as
returned by an earlier call.
4.5. Interface `Document` [[Exposed](https://webidl.spec.whatwg.org/#Exposed)=Window]
interface `Document` : Node {
constructor();
[[SameObject](https://webidl.spec.whatwg.org/#SameObject)] readonly attribute DOMImplementation implementation;
readonly attribute [USVString](https://webidl.spec.whatwg.org/#idl-USVString) URL;
readonly attribute [USVString](https://webidl.spec.whatwg.org/#idl-USVString) documentURI;
readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) compatMode;
readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) characterSet;
readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) charset; // legacy alias of .characterSet
readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) inputEncoding; // legacy alias of .characterSet
readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) contentType;
readonly attribute DocumentType? doctype;
readonly attribute Element? documentElement;
HTMLCollection getElementsByTagName([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`);
HTMLCollection getElementsByTagNameNS([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`, [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `localName`);
HTMLCollection getElementsByClassName([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `classNames`);
[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions), [NewObject](https://webidl.spec.whatwg.org/#NewObject)] Element createElement([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `localName`, optional ([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) or ElementCreationOptions) `options` = {});
[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions), [NewObject](https://webidl.spec.whatwg.org/#NewObject)] Element createElementNS([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`, [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`, optional ([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) or ElementCreationOptions) `options` = {});
[[NewObject](https://webidl.spec.whatwg.org/#NewObject)] DocumentFragment createDocumentFragment();
[[NewObject](https://webidl.spec.whatwg.org/#NewObject)] Text createTextNode([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `data`);
[[NewObject](https://webidl.spec.whatwg.org/#NewObject)] CDATASection createCDATASection([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `data`);
[[NewObject](https://webidl.spec.whatwg.org/#NewObject)] Comment createComment([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `data`);
[[NewObject](https://webidl.spec.whatwg.org/#NewObject)] ProcessingInstruction createProcessingInstruction([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `target`, [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `data`);
[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions), [NewObject](https://webidl.spec.whatwg.org/#NewObject)] Node importNode(Node `node`, optional ([boolean](https://webidl.spec.whatwg.org/#idl-boolean) or ImportNodeOptions) `options` = false);
[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)] Node adoptNode(Node `node`);
[[NewObject](https://webidl.spec.whatwg.org/#NewObject)] Attr createAttribute([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `localName`);
[[NewObject](https://webidl.spec.whatwg.org/#NewObject)] Attr createAttributeNS([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`, [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`);
[[NewObject](https://webidl.spec.whatwg.org/#NewObject)] Event createEvent([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `interface`); // legacy
[[NewObject](https://webidl.spec.whatwg.org/#NewObject)] Range createRange();
// NodeFilter.SHOW_ALL = 0xFFFFFFFF
[[NewObject](https://webidl.spec.whatwg.org/#NewObject)] NodeIterator createNodeIterator(Node `root`, optional [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `whatToShow` = 0xFFFFFFFF, optional NodeFilter? `filter` = null);
[[NewObject](https://webidl.spec.whatwg.org/#NewObject)] TreeWalker createTreeWalker(Node `root`, optional [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `whatToShow` = 0xFFFFFFFF, optional NodeFilter? `filter` = null);
};
[[Exposed](https://webidl.spec.whatwg.org/#Exposed)=Window]
interface `XMLDocument` : Document {};
dictionary `ElementCreationOptions` {
[CustomElementRegistry](https://html.spec.whatwg.org/multipage/custom-elements.html#customelementregistry)? `customElementRegistry`;
[DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `is`;
};
dictionary `ImportNodeOptions` {
[CustomElementRegistry](https://html.spec.whatwg.org/multipage/custom-elements.html#customelementregistry) `customElementRegistry`;
[boolean](https://webidl.spec.whatwg.org/#idl-boolean) `selfOnly` = false;
};
`Document` nodes are simply
known as documents.
A document’s node document is itself.
Each document has an associated
encoding (an [encoding](https://encoding.spec.whatwg.org/#encoding)),
content type (a string),
URL (a [URL](https://url.spec.whatwg.org/#concept-url)),
origin (an [origin](https://html.spec.whatwg.org/multipage/browsers.html#concept-origin)),
type ("`xml`" or "`html`"),
mode ("`no-quirks`", "`quirks`", or "`limited-quirks`"),
allow declarative shadow roots (a boolean), and
custom element registry (null or a `[CustomElementRegistry](https://html.spec.whatwg.org/multipage/custom-elements.html#customelementregistry)` object).
[ENCODING] [URL] [HTML] Unless stated otherwise, a document’s encoding is the
[utf-8](https://encoding.spec.whatwg.org/#utf-8) [encoding](https://encoding.spec.whatwg.org/#encoding), content type is
"`application/xml`", URL is "`about:blank`",
origin is an [opaque origin](https://html.spec.whatwg.org/multipage/browsers.html#concept-origin-opaque),
type is "`xml`", mode is
"`no-quirks`", allow declarative shadow roots is false, and
custom element registry is null.
A document is said to be an XML document if its
type is "`xml`"; otherwise an HTML document.
Whether a document is an HTML document or an XML document affects the
behavior of certain APIs.
A document is said to be in
no-quirks mode if its
mode is "`no-quirks`",
quirks mode if its mode
is "`quirks`", and
limited-quirks mode if its
mode is "`limited-quirks`".
The mode is only ever changed from the default for documents
created by the [HTML parser](https://html.spec.whatwg.org/multipage/parsing.html#html-parser) based on the presence, absence, or value of the DOCTYPE string,
and by a new [browsing context](https://html.spec.whatwg.org/multipage/document-sequences.html#browsing-context) (initial "`about:blank`"). [HTML] No-quirks mode was originally known as "standards mode" and limited-quirks mode
was once known as "almost standards mode". They have been renamed because their details are now
defined by standards. (And because Ian Hickson vetoed their original names on the basis that they
are nonsensical.)
A document’s get the parent algorithm, given an event, returns
null if event’s `type` attribute value is "`load`" or
document does not have a [browsing context](https://html.spec.whatwg.org/multipage/document-sequences.html#concept-document-bc); otherwise the
document’s [relevant global object](https://html.spec.whatwg.org/multipage/webappapis.html#concept-relevant-global).
To create a document that implements an interface interface,
given a [realm](https://tc39.es/ecma262/#realm) realm:
[Assert](https://infra.spec.whatwg.org/#assert): interface is `Document` or an interface that inherits from
`Document`.
Return a new node that [implements](https://webidl.spec.whatwg.org/#implements) interface, in
realm.
`document = new `Document()`` Returns a new document.
`document . `implementation`` Returns document’s `DOMImplementation` object.
`document . `URL``
`document . `documentURI`` Returns document’s URL.
`document . `compatMode``
Returns the string "`BackCompat`" if document’s mode is
"`quirks`"; otherwise "`CSS1Compat`".
`document . `characterSet`` Returns document’s
encoding.
`document . `contentType`` Returns document’s
content type.
The `new Document()` constructor
steps are to set [this](https://webidl.spec.whatwg.org/#this)’s origin to the origin of
[current global object](https://html.spec.whatwg.org/multipage/webappapis.html#current-global-object)’s [associated `Document`](https://html.spec.whatwg.org/multipage/nav-history-apis.html#concept-document-window). [HTML] Unlike `createDocument()`, this constructor does not
return an `XMLDocument` object, but a document (`Document` object).
The
`implementation` getter steps are to return the
`DOMImplementation` object that is associated with [this](https://webidl.spec.whatwg.org/#this).
The `URL` and
`documentURI` getter steps are to return [this](https://webidl.spec.whatwg.org/#this)’s
URL, [serialized](https://url.spec.whatwg.org/#concept-url-serializer).
The `compatMode` getter steps are to return
"`BackCompat`" if [this](https://webidl.spec.whatwg.org/#this)’s mode is "`quirks`";
otherwise "`CSS1Compat`".
The `characterSet`,
`charset`, and
`inputEncoding` getter steps are to return
[this](https://webidl.spec.whatwg.org/#this)’s encoding’s [name](https://encoding.spec.whatwg.org/#name).
The `contentType` getter steps are to return
[this](https://webidl.spec.whatwg.org/#this)’s content type.
document . `doctype` Returns the doctype or null if
there is none.
document . `documentElement` Returns the document element.
`collection = document . getElementsByTagName(qualifiedName)` If qualifiedName is "`*`" returns an `HTMLCollection` of all
descendant elements.
Otherwise, returns an `HTMLCollection` of all descendant elements whose qualified name is qualifiedName.
(Matches case-insensitively against elements in the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace) within an
HTML document.)
`collection = document . getElementsByTagNameNS(namespace, localName)` If namespace and localName are "`*`", returns an
`HTMLCollection` of all descendant elements.
If only namespace is "`*`", returns an `HTMLCollection` of all
descendant elements whose local name is
localName.
If only localName is "`*`", returns an `HTMLCollection` of all
descendant elements whose namespace is
namespace.
Otherwise, returns an `HTMLCollection` of all descendant elements whose namespace is namespace and
local name is localName.
`collection = document . getElementsByClassName(classNames)`
`collection = element . getElementsByClassName(classNames)` Returns an `HTMLCollection` of the elements in the object on which the method
was invoked (a document or an element) that have all the classes given by
classNames. The classNames argument is interpreted as a space-separated list
of classes.
The `doctype` getter steps are to return the
child of [this](https://webidl.spec.whatwg.org/#this) that is a doctype; otherwise null.
The `documentElement` getter steps are to return
[this](https://webidl.spec.whatwg.org/#this)’s document element.
The `getElementsByTagName(qualifiedName)`
method steps are to return the list of elements with qualified name qualifiedName
for [this](https://webidl.spec.whatwg.org/#this).
Thus, in an HTML document,
`document.getElementsByTagName("FOO")` will match
`` elements that are not in the
[HTML namespace](https://infra.spec.whatwg.org/#html-namespace), and `` elements that are in
the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace), but not `` elements
that are in the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace).
The
`getElementsByTagNameNS(namespace, localName)`
method steps are to return the list of elements with namespace namespace and local
name localName for [this](https://webidl.spec.whatwg.org/#this).
The `getElementsByClassName(classNames)`
method steps are to return the list of elements with class names classNames for
[this](https://webidl.spec.whatwg.org/#this).
Given the following XHTML fragment:
`` A call to
`document.getElementById("example").getElementsByClassName("aaa")`
would return an `HTMLCollection` with the two paragraphs
`p1` and `p2` in it. A call to
`getElementsByClassName("ccc bbb")`
would only return one node, however, namely `p3`. A call to
`document.getElementById("example").getElementsByClassName("bbb ccc ")`
would return the same thing. A call to
`getElementsByClassName("aaa,bbb")`
would return no nodes; none of the elements above are in the
`aaa,bbb` class.
`element = document . createElement(localName [, options])` Returns an element with localName as local name
(if document is an HTML document, localName gets lowercased). The
element’s namespace is the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace) when
document is an HTML document or document’s
content type is "`application/xhtml+xml`"; otherwise null.
When supplied, options’s `customElementRegistry` can be
used to set the `[CustomElementRegistry](https://html.spec.whatwg.org/multipage/custom-elements.html#customelementregistry)`.
When supplied, options’s `is` can be used to create a
[customized built-in element](https://html.spec.whatwg.org/multipage/custom-elements.html#customized-built-in-element).
If localName is not a valid element local name an
"`[InvalidCharacterError](https://webidl.spec.whatwg.org/#invalidcharactererror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)` will be thrown.
When both options’s `customElementRegistry` and
options’s `is` are supplied, a
"`[NotSupportedError](https://webidl.spec.whatwg.org/#notsupportederror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)` will be thrown.
`element = document . createElementNS(namespace, qualifiedName [, options])` Returns an element with namespace namespace. Its
namespace prefix will be everything before U+003A (:) in
qualifiedName or null. Its local name will be everything after
U+003A (:) in qualifiedName or qualifiedName.
When supplied, options’s `customElementRegistry` can be
used to set the `[CustomElementRegistry](https://html.spec.whatwg.org/multipage/custom-elements.html#customelementregistry)`.
When supplied, options’s `is` can be used to create a
[customized built-in element](https://html.spec.whatwg.org/multipage/custom-elements.html#customized-built-in-element).
If qualifiedName is not a (possibly-prefixed)
valid element local name an "`[InvalidCharacterError](https://webidl.spec.whatwg.org/#invalidcharactererror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)` will be
thrown.
If one of the following conditions is true a "`[NamespaceError](https://webidl.spec.whatwg.org/#namespaceerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`
will be thrown:
Namespace prefix
is non-null and namespace is the empty string.
Namespace prefix
is "`xml`" and namespace is not the
[XML namespace](https://infra.spec.whatwg.org/#xml-namespace).
qualifiedName or
namespace prefix
is "`xmlns`" and namespace is not the
[XMLNS namespace](https://infra.spec.whatwg.org/#xmlns-namespace).
namespace is the [XMLNS namespace](https://infra.spec.whatwg.org/#xmlns-namespace) and
neither qualifiedName nor
namespace prefix
is "`xmlns`".
When both options’s `customElementRegistry` and
options’s `is` are supplied, a
"`[NotSupportedError](https://webidl.spec.whatwg.org/#notsupportederror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)` will be thrown.
`documentFragment = document . `createDocumentFragment()`` Returns a `DocumentFragment` node.
`text = document . `createTextNode(data)`` Returns a `Text` node
whose data is data.
`text = document . `createCDATASection(data)`` Returns a `CDATASection` node whose data is
data.
`comment = document . `createComment(data)`` Returns a `Comment` node whose data is data.
`processingInstruction = document . `createProcessingInstruction(target, data)``
Returns a `ProcessingInstruction` node whose
target is target and
data is data.
If target does not match the `[Name](https://www.w3.org/TR/xml/#NT-Name)` production an
"`[InvalidCharacterError](https://webidl.spec.whatwg.org/#invalidcharactererror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)` will be thrown.
If data contains "`?>`" an
"`[InvalidCharacterError](https://webidl.spec.whatwg.org/#invalidcharactererror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)` will be thrown.
The element interface for any name and
namespace is `Element`, unless stated otherwise.
The HTML Standard will, e.g., define that for `html` and the
[HTML namespace](https://infra.spec.whatwg.org/#html-namespace), the `[HTMLHtmlElement](https://html.spec.whatwg.org/multipage/semantics.html#htmlhtmlelement)` interface is used. [HTML] The
`createElement(localName, options)`
method steps are:
If localName is not a valid element local name, then
[throw](https://webidl.spec.whatwg.org/#dfn-throw) an "`[InvalidCharacterError](https://webidl.spec.whatwg.org/#invalidcharactererror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
If [this](https://webidl.spec.whatwg.org/#this) is an HTML document, then set localName to
localName in [ASCII lowercase](https://infra.spec.whatwg.org/#ascii-lowercase).
Let registry and is be the result of
flattening element creation options given options and [this](https://webidl.spec.whatwg.org/#this).
Let namespace be the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace), if [this](https://webidl.spec.whatwg.org/#this) is an
HTML document or [this](https://webidl.spec.whatwg.org/#this)’s content type is
"`application/xhtml+xml`"; otherwise null.
Return the result of creating an element given [this](https://webidl.spec.whatwg.org/#this), localName,
namespace, null, is, true, and registry.
The internal `createElementNS` steps, given document,
namespace, qualifiedName, and options, are as follows:
Let (namespace, prefix, localName) be the result of
validating and extracting namespace and
qualifiedName given "`element`".
Let registry and is be the result of
flattening element creation options given options and [this](https://webidl.spec.whatwg.org/#this).
Return the result of creating an element given document,
localName, namespace, prefix, is, true, and
registry.
The
`createElementNS(namespace, qualifiedName, options)`
method steps are to return the result of running the
internal `createElementNS` steps, given [this](https://webidl.spec.whatwg.org/#this), namespace,
qualifiedName, and options.
To flatten element creation options, given a string or `ElementCreationOptions`
dictionary options and a document document:
Let registry be the result of [looking up a custom element registry](https://html.spec.whatwg.org/multipage/custom-elements.html#look-up-a-custom-element-registry)
given document.
Let is be null.
If options is a dictionary:
If options["`is`"] [exists](https://infra.spec.whatwg.org/#map-exists), then set
is to it.
If options["`customElementRegistry`"]
[exists](https://infra.spec.whatwg.org/#map-exists):
If is is non-null, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NotSupportedError](https://webidl.spec.whatwg.org/#notsupportederror)`"
`[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
Set registry to
options["`customElementRegistry`"].
If registry is non-null, registry’s
[is scoped](https://html.spec.whatwg.org/multipage/custom-elements.html#is-scoped) is false, and registry is not
document’s custom element registry, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a
"`[NotSupportedError](https://webidl.spec.whatwg.org/#notsupportederror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
Return registry and is.
`createElement()` and `createElementNS()`’s options
parameter is allowed to be a string for web compatibility.
The `createDocumentFragment()` method steps are to
return the result of creating a document fragment given [this](https://webidl.spec.whatwg.org/#this).
The `createTextNode(data)` method steps are
to return the result of creating a text node given [this](https://webidl.spec.whatwg.org/#this) and data.
The `createCDATASection(data)` method steps
are:
If [this](https://webidl.spec.whatwg.org/#this) is an HTML document, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a
"`[NotSupportedError](https://webidl.spec.whatwg.org/#notsupportederror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
If data contains the string "`]]>`", then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an
"`[InvalidCharacterError](https://webidl.spec.whatwg.org/#invalidcharactererror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
Let node be the result of creating a node that implements
`CDATASection`, given [this](https://webidl.spec.whatwg.org/#this).
Set node’s data to data.
Return node.
The `createComment(data)` method steps are to
return the result of given [this](https://webidl.spec.whatwg.org/#this) and data.
The
`createProcessingInstruction(target, data)`
method steps are to return the result of creating a processing instruction node given
[this](https://webidl.spec.whatwg.org/#this), target, and data.
`clone = document . importNode(node [, options = false])` Returns a copy of node. If options is true or options is a
dictionary whose `selfOnly` is false, the copy also includes the
node’s descendants.
options’s `customElementRegistry` can be used to set the
`[CustomElementRegistry](https://html.spec.whatwg.org/multipage/custom-elements.html#customelementregistry)` of elements that have none.
If node is a document or a shadow root, throws a
"`[NotSupportedError](https://webidl.spec.whatwg.org/#notsupportederror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
`node = document . adoptNode(node)` Moves node from another document and returns it.
If node is a document, throws a "`[NotSupportedError](https://webidl.spec.whatwg.org/#notsupportederror)`"
`[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)` or, if node is a shadow root, throws a
"`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
The `importNode(node, options)`
method steps are:
If node is a document or shadow root, then [throw](https://webidl.spec.whatwg.org/#dfn-throw)
a "`[NotSupportedError](https://webidl.spec.whatwg.org/#notsupportederror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
Let subtree be false.
Let registry be null.
If options is a boolean, then set subtree to options.
Otherwise:
Set subtree to the negation of
options["`selfOnly`"].
If options["`customElementRegistry`"]
[exists](https://infra.spec.whatwg.org/#map-exists), then set registry to it.
If registry’s [is scoped](https://html.spec.whatwg.org/multipage/custom-elements.html#is-scoped) is false and
registry is not [this](https://webidl.spec.whatwg.org/#this)’s custom element registry, then
[throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NotSupportedError](https://webidl.spec.whatwg.org/#notsupportederror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
If registry is null, then set registry to the result of
[looking up a custom element registry](https://html.spec.whatwg.org/multipage/custom-elements.html#look-up-a-custom-element-registry) given [this](https://webidl.spec.whatwg.org/#this).
Return the result of cloning a node given node with
*document* set to [this](https://webidl.spec.whatwg.org/#this),
*subtree* set to subtree, and
*fallbackRegistry* set to registry.
Specifications may define
adopting steps for all or some nodes. The
algorithm is passed node and oldDocument, as indicated in the
adopt algorithm.
To adopt a node node into a
document document:
Let oldDocument be node’s node document.
If node’s parent is non-null, then remove node.
If document is not oldDocument, then for each
inclusiveDescendant of node’s shadow-including inclusive descendants,
in shadow-including tree order:
Set inclusiveDescendant’s node document to document.
If inclusiveDescendant is a shadow root and if any of the following
are true:
inclusiveDescendant’s custom element registry is null
and inclusiveDescendant’s keep custom element registry null is
false; or
inclusiveDescendant’s custom element registry is a global custom element registry,
then set inclusiveDescendant’s custom element registry to
document’s custom element registry’s
effective global custom element registry.
Otherwise, if inclusiveDescendant is an element:
Set the node document of each attribute in
inclusiveDescendant’s attribute list to document.
If inclusiveDescendant’s custom element registry is null or
inclusiveDescendant’s custom element registry’s
[is scoped](https://html.spec.whatwg.org/multipage/custom-elements.html#is-scoped) is false:
Let registry be null.
If inclusiveDescendant’s custom element registry is
non-null, inclusiveDescendant’s parent is null, or
inclusiveDescendant’s parent is an
exclusive `DocumentFragment` node, then set registry to
document’s custom element registry.
Otherwise, set registry to the result of
[looking up a custom element registry](https://html.spec.whatwg.org/multipage/custom-elements.html#look-up-a-custom-element-registry) given inclusiveDescendant’s
parent.
Set inclusiveDescendant’s custom element registry to
registry’s effective global custom element registry.
If inclusiveDescendant is custom, then
[enqueue a custom element callback reaction](https://html.spec.whatwg.org/multipage/custom-elements.html#enqueue-a-custom-element-callback-reaction) with inclusiveDescendant, callback
name "`adoptedCallback`", and « oldDocument, document ».
Run the adopting steps with inclusiveDescendant and
oldDocument.
The `adoptNode(node)` method steps are:
If node is a document, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a
"`[NotSupportedError](https://webidl.spec.whatwg.org/#notsupportederror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
If node is a shadow root, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a
"`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
Adopt node into [this](https://webidl.spec.whatwg.org/#this).
Return node.
Null or a `[CustomElementRegistry](https://html.spec.whatwg.org/multipage/custom-elements.html#customelementregistry)` object registry is a global custom element registry if registry is non-null and
registry’s [is scoped](https://html.spec.whatwg.org/multipage/custom-elements.html#is-scoped) is false.
Null or a `[CustomElementRegistry](https://html.spec.whatwg.org/multipage/custom-elements.html#customelementregistry)` object registry’s
effective global custom element registry is:
If registry is a global custom element registry, then return
registry.
Return null.
The `createAttribute(localName)` method
steps are:
If localName is not a valid attribute local name, then
[throw](https://webidl.spec.whatwg.org/#dfn-throw) an "`[InvalidCharacterError](https://webidl.spec.whatwg.org/#invalidcharactererror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
If [this](https://webidl.spec.whatwg.org/#this) is an HTML document, then set localName to
localName in [ASCII lowercase](https://infra.spec.whatwg.org/#ascii-lowercase).
Return the result of creating an attribute given [this](https://webidl.spec.whatwg.org/#this) and localName.
The
`createAttributeNS(namespace, qualifiedName)`
method steps are:
Let (namespace, prefix, localName) be the result of
validating and extracting namespace and
qualifiedName given "`attribute`".
Return the result of creating an attribute given [this](https://webidl.spec.whatwg.org/#this), localName,
namespace, and prefix.
The `createEvent(interface)` method steps
are:
Let constructor be null.
If interface is an [ASCII case-insensitive](https://infra.spec.whatwg.org/#ascii-case-insensitive) match for any of the strings in the
first column in the following table, then set constructor to the interface in the
second column on the same row as the matching string:
String
Interface
Notes
"`beforeunloadevent`"
`[BeforeUnloadEvent](https://html.spec.whatwg.org/multipage/nav-history-apis.html#beforeunloadevent)` [HTML] "`compositionevent`"
`[CompositionEvent](https://w3c.github.io/uievents/#compositionevent)` [UIEVENTS] "`customevent`"
`CustomEvent` "`devicemotionevent`"
`[DeviceMotionEvent](https://w3c.github.io/deviceorientation/spec-source-orientation.html#devicemotion)` [DEVICE-ORIENTATION] "`deviceorientationevent`"
`[DeviceOrientationEvent](https://w3c.github.io/deviceorientation/spec-source-orientation.html#devicemotion)` "`dragevent`"
`[DragEvent](https://html.spec.whatwg.org/multipage/dnd.html#dragevent)` [HTML] "`event`"
`Event` "`events`"
"`focusevent`"
`[FocusEvent](https://w3c.github.io/uievents/#focusevent)` [UIEVENTS] "`hashchangeevent`"
`[HashChangeEvent](https://html.spec.whatwg.org/multipage/nav-history-apis.html#hashchangeevent)` [HTML] "`htmlevents`"
`Event` "`keyboardevent`"
`[KeyboardEvent](https://w3c.github.io/uievents/#keyboardevent)` [UIEVENTS] "`messageevent`"
`[MessageEvent](https://html.spec.whatwg.org/multipage/comms.html#messageevent)` [HTML] "`mouseevent`"
`[MouseEvent](https://w3c.github.io/pointerevents/#dom-mouseevent)` [UIEVENTS] "`mouseevents`"
"`storageevent`"
`[StorageEvent](https://html.spec.whatwg.org/multipage/webstorage.html#storageevent)` [HTML] "`svgevents`"
`Event` "`textevent`"
`[TextEvent](https://w3c.github.io/uievents/#textevent)` [UIEVENTS] "`touchevent`"
`[TouchEvent](https://w3c.github.io/touch-events/#idl-def-touchevent)` [TOUCH-EVENTS] "`uievent`"
`[UIEvent](https://w3c.github.io/uievents/#uievent)` [UIEVENTS] "`uievents`"
If constructor is null, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NotSupportedError](https://webidl.spec.whatwg.org/#notsupportederror)`"
`[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
If the interface indicated by constructor is not exposed on the
[relevant global object](https://html.spec.whatwg.org/multipage/webappapis.html#concept-relevant-global) of [this](https://webidl.spec.whatwg.org/#this), then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a
"`[NotSupportedError](https://webidl.spec.whatwg.org/#notsupportederror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
Typically user agents disable support for touch events in some configurations, in
which case this clause would be triggered for the interface `[TouchEvent](https://w3c.github.io/touch-events/#idl-def-touchevent)`.
Let event be the result of creating an event given constructor.
Initialize event’s `type` attribute to the empty string.
Initialize event’s `timeStamp` attribute to the result of calling
[current high resolution time](https://w3c.github.io/hr-time/#dfn-current-high-resolution-time) with [this](https://webidl.spec.whatwg.org/#this)’s [relevant global object](https://html.spec.whatwg.org/multipage/webappapis.html#concept-relevant-global).
Initialize event’s `isTrusted` attribute to false.
Unset event’s initialized flag.
Return event.
Event constructors ought to be used instead.
The `createRange()` method steps are to return a new
live range with ([this](https://webidl.spec.whatwg.org/#this), 0) as its start an end.
The `Range()` constructor can be used instead.
The
`createNodeIterator(root, whatToShow, filter)`
method steps are:
Let iterator be a new `NodeIterator` object.
Set iterator’s root to root.
Set iterator’s reference to (root, true).
Set iterator’s whatToShow to whatToShow.
Set iterator’s filter to filter.
Return iterator.
The
`createTreeWalker(root, whatToShow, filter)`
method steps are:
Let walker be a new `TreeWalker` object.
Set walker’s root and walker’s
current to root.
Set walker’s whatToShow to whatToShow.
Set walker’s filter to filter.
Return walker.
4.5.1. Interface `DOMImplementation` User agents must create a `DOMImplementation` object whenever a document is
created and associate it with that document.
[[Exposed](https://webidl.spec.whatwg.org/#Exposed)=Window]
interface `DOMImplementation` {
[[NewObject](https://webidl.spec.whatwg.org/#NewObject)] DocumentType createDocumentType([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `name`, [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `publicId`, [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `systemId`);
[[NewObject](https://webidl.spec.whatwg.org/#NewObject)] XMLDocument createDocument([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`, [[LegacyNullToEmptyString](https://webidl.spec.whatwg.org/#LegacyNullToEmptyString)] [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`, optional DocumentType? `doctype` = null);
[[NewObject](https://webidl.spec.whatwg.org/#NewObject)] Document createHTMLDocument(optional [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `title`);
[boolean](https://webidl.spec.whatwg.org/#idl-boolean) hasFeature(); // historical; always returns true
};
`doctype = document . `implementation` . `createDocumentType(name, publicId, systemId)``
Returns a doctype, with the given name, publicId, and systemId.
If name is not a valid doctype name, an "`[InvalidCharacterError](https://webidl.spec.whatwg.org/#invalidcharactererror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)` is thrown.
`doc = document . `implementation` . createDocument(namespace, qualifiedName [, doctype = null])`
Returns an `XMLDocument`, with a
document element whose
local name is
qualifiedName and whose
namespace is
namespace (unless qualifiedName is the
empty string), and with doctype, if it is given, as its
doctype.
This method throws the same exceptions as the `createElementNS()` method, when
invoked with namespace and qualifiedName.
`doc = document . `implementation` . createHTMLDocument([title])`
Returns a document, with a basic
tree already constructed including a
`[title](https://html.spec.whatwg.org/multipage/semantics.html#the-title-element)` element, unless the title
argument is omitted.
The
`createDocumentType(name, publicId, systemId)`
method steps are:
If name is not a valid doctype name, then throw an "`[InvalidCharacterError](https://webidl.spec.whatwg.org/#invalidcharactererror)`"
`[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
Return the result of creating a doctype given the associated document of
[this](https://webidl.spec.whatwg.org/#this), name, publicId, and systemId.
The
`createDocument(namespace, qualifiedName, doctype)`
method steps are:
Let document be the result of creating a document that implements
`XMLDocument`, given [this](https://webidl.spec.whatwg.org/#this)’s [relevant realm](https://html.spec.whatwg.org/multipage/webappapis.html#concept-relevant-realm).
Let element be null.
If qualifiedName is not the empty string, then set element to the
result of running the internal `createElementNS` steps, given
document, namespace, qualifiedName, and an empty dictionary.
If doctype is non-null, append doctype to document.
If element is non-null, append element to document.
document’s origin is [this](https://webidl.spec.whatwg.org/#this)’s associated
document’s origin.
document’s content type is determined by namespace:
[HTML namespace](https://infra.spec.whatwg.org/#html-namespace) `application/xhtml+xml` [SVG namespace](https://infra.spec.whatwg.org/#svg-namespace) `image/svg+xml` Any other namespace
`application/xml` Return document.
The
`createHTMLDocument(title)`
method steps are:
Let doc be the result of creating a document that implements
`Document`, given [this](https://webidl.spec.whatwg.org/#this)’s [relevant realm](https://html.spec.whatwg.org/multipage/webappapis.html#concept-relevant-realm).
Set doc’s type to "`html`" and
content type to "`text/html`".
Let doctype be the result of creating a doctype given doc and
"`html`".
Append doctype to doc.
Append the result of creating an element given doc,
"`html`", and the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace), to doc.
Append the result of creating an element given doc,
"`head`", and the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace), to the `[html](https://html.spec.whatwg.org/multipage/semantics.html#the-html-element)` element created earlier.
If title is given:
Append the result of creating an element given doc,
"`title`", and the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace), to the `[head](https://html.spec.whatwg.org/multipage/semantics.html#the-head-element)` element created earlier.
Let text be the result of creating a text node given doc and
title (which could be the empty string).
Append text to the `[title](https://html.spec.whatwg.org/multipage/semantics.html#the-title-element)` element created earlier.
Append the result of creating an element given doc,
"`body`", and the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace), to the `[html](https://html.spec.whatwg.org/multipage/semantics.html#the-html-element)` element created earlier.
doc’s origin is [this](https://webidl.spec.whatwg.org/#this)’s associated
document’s origin.
Return doc.
The `hasFeature()` method steps are to
return true.
`hasFeature()` originally would report whether the user agent
claimed to support a given DOM feature, but experience proved it was not nearly as
reliable or granular as simply checking whether the desired objects, attributes, or
methods existed. As such, it is no longer to be used, but continues to exist (and simply
returns true) so that old pages don’t stop working.
4.6. Interface `DocumentType` [[Exposed](https://webidl.spec.whatwg.org/#Exposed)=Window]
interface `DocumentType` : Node {
readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) name;
readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) publicId;
readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) systemId;
};
`DocumentType` nodes are simply known as
doctypes.
Doctypes have an associated
name (a string),
public ID (a string), and
system ID (a string).
To create a doctype given a document document, a string
name, and optionally a string publicId (default the empty string) and a string
systemId (default the empty string):
Let doctype be the result of creating a node that implements
`DocumentType`, given document.
Set doctype’s name to name, public ID to
publicId, and system ID to systemId.
Return doctype.
The `name` getter steps are to return
[this](https://webidl.spec.whatwg.org/#this)’s name.
The `publicId` getter steps are to return
[this](https://webidl.spec.whatwg.org/#this)’s public ID.
The `systemId` getter steps are to return
[this](https://webidl.spec.whatwg.org/#this)’s system ID.
4.7. Interface `DocumentFragment` [[Exposed](https://webidl.spec.whatwg.org/#Exposed)=Window]
interface `DocumentFragment` : Node {
constructor();
};
`tree = new `DocumentFragment()`` Returns a new `DocumentFragment` node.
An exclusive `DocumentFragment` node is a `DocumentFragment` node that is not a `ShadowRoot` node.
A `DocumentFragment` node has an associated
host (null or an
element in a different node tree). It is null unless otherwise stated.
An object A is a
host-including inclusive ancestor
of an object B, if either A is an inclusive ancestor of B,
or if B’s root has a non-null host and
A is a host-including inclusive ancestor of B’s root’s
host.
The `DocumentFragment` node’s host
concept is useful for HTML’s `[template](https://html.spec.whatwg.org/multipage/scripting.html#the-template-element)` element and for shadow roots, and impacts the
pre-insert and replace algorithms.
To create a document fragment given a document document: return the result of creating a node that implements
`DocumentFragment`, given document.
The
`new DocumentFragment()`
constructor steps are to set [this](https://webidl.spec.whatwg.org/#this)’s node document to
[current global object](https://html.spec.whatwg.org/multipage/webappapis.html#current-global-object)’s [associated `Document`](https://html.spec.whatwg.org/multipage/nav-history-apis.html#concept-document-window).
4.8. Interface `ShadowRoot` [[Exposed](https://webidl.spec.whatwg.org/#Exposed)=Window]
interface `ShadowRoot` : DocumentFragment {
readonly attribute ShadowRootMode mode;
readonly attribute [boolean](https://webidl.spec.whatwg.org/#idl-boolean) delegatesFocus;
readonly attribute [boolean](https://webidl.spec.whatwg.org/#idl-boolean) serializable;
readonly attribute SlotAssignmentMode slotAssignment;
readonly attribute [boolean](https://webidl.spec.whatwg.org/#idl-boolean) clonable;
readonly attribute Element host;
attribute [EventHandler](https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler) onslotchange;
};
enum `ShadowRootMode` { `"open"`, `"closed"` };
enum `SlotAssignmentMode` { `"manual"`, `"named"` };
`ShadowRoot` nodes are simply known as
shadow roots.
Shadow roots’s associated host is never null.
Shadow roots have an associated mode ("`open`"
or "`closed`").
Shadow roots have an associated delegates focus
(a boolean). It is initially set to false.
Shadow roots have an associated
available to element internals (a boolean). It is initially set to
false.
Shadow roots have an associated declarative
(a boolean). It is initially set to false.
Shadow roots have an associated serializable (a boolean).
It is initially set to false.
Shadow roots have an associated slot assignment
("`manual`" or "`named`").
Shadow roots have an associated clonable (a boolean).
It is initially set to false.
Shadow roots have an associated custom element registry
(null or a `[CustomElementRegistry](https://html.spec.whatwg.org/multipage/custom-elements.html#customelementregistry)` object). It is initially null.
Shadow roots have an associated
keep custom element registry null (a boolean). It is initially false.
This can only ever be true in combination with declarative shadow roots. And it only
matters for as long as the shadow root’s custom element registry
is null.
A shadow root’s get the parent algorithm, given an event, returns
null if event’s composed flag is unset and shadow root is the
root of event’s path’s first event path item’s
invocation target; otherwise shadow root’s
host.
The `mode` getter steps are to return
[this](https://webidl.spec.whatwg.org/#this)’s mode.
The `delegatesFocus` getter steps are to return
[this](https://webidl.spec.whatwg.org/#this)’s delegates focus.
The `serializable` getter steps are to return
[this](https://webidl.spec.whatwg.org/#this)’s serializable.
The `slotAssignment` getter steps are to return
[this](https://webidl.spec.whatwg.org/#this)’s slot assignment.
The `clonable` getter steps are to return
[this](https://webidl.spec.whatwg.org/#this)’s clonable.
The `host` getter steps are to return
[this](https://webidl.spec.whatwg.org/#this)’s host.
The `onslotchange` attribute is an
[event handler IDL attribute](https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-idl-attributes) for the
`onslotchange` [event handler](https://html.spec.whatwg.org/multipage/webappapis.html#event-handlers), whose
[event handler event type](https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-event-type) is `slotchange`.
In shadow-including tree order is
shadow-including preorder, depth-first traversal of a node tree.
Shadow-including preorder, depth-first traversal of a node tree tree is preorder, depth-first traversal of tree, with for each
shadow host encountered in tree,
shadow-including preorder, depth-first traversal of that element’s
shadow root’s node tree just after it is encountered.
The shadow-including root of an object is its
root’s host’s shadow-including root, if the
object’s root is a shadow root; otherwise its root.
An object A is a
shadow-including descendant of an object
B, if A is a descendant of B, or A’s
root is a shadow root and A’s root’s
host is a shadow-including inclusive descendant of B.
A
shadow-including inclusive descendant
is an object or one of its shadow-including descendants.
An object A is a
shadow-including ancestor of an object
B, if and only if B is a shadow-including descendant of A.
A
shadow-including inclusive ancestor
is an object or one of its shadow-including ancestors.
A node A is
closed-shadow-hidden from a node B if all of the following conditions are true:
A’s root is a shadow root.
A’s root is not a shadow-including inclusive ancestor of
B.
A’s root is a shadow root whose
mode is "`closed`" or A’s root’s
host is closed-shadow-hidden from B.
To retarget an object A against an object
B, repeat these steps until they return an object:
If one of the following is true
A is not a node A’s root is not a shadow root B is a node and A’s root is a
shadow-including inclusive ancestor of B then return A.
Set A to A’s root’s host.
The retargeting algorithm is used by event dispatch as well
as other specifications, such as Fullscreen. [FULLSCREEN] 4.9. Interface `Element` [[Exposed](https://webidl.spec.whatwg.org/#Exposed)=Window]
interface `Element` : Node {
readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? namespaceURI;
readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? prefix;
readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) localName;
readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) tagName;
[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)] attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) id;
[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)] attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) className;
[[SameObject](https://webidl.spec.whatwg.org/#SameObject), [PutForwards](https://webidl.spec.whatwg.org/#PutForwards)=value] readonly attribute DOMTokenList classList;
[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions), [Unscopable](https://webidl.spec.whatwg.org/#Unscopable)] attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) slot;
[boolean](https://webidl.spec.whatwg.org/#idl-boolean) hasAttributes();
[[SameObject](https://webidl.spec.whatwg.org/#SameObject)] readonly attribute NamedNodeMap attributes;
[sequence](https://webidl.spec.whatwg.org/#idl-sequence)<[DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)> getAttributeNames();
[DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? getAttribute([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`);
[DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? getAttributeNS([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`, [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `localName`);
[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) setAttribute([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`, ([TrustedType](https://w3c.github.io/trusted-types/dist/spec/#typedefdef-trustedtype) or [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)) `value`);
[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) setAttributeNS([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`, [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`, ([TrustedType](https://w3c.github.io/trusted-types/dist/spec/#typedefdef-trustedtype) or [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)) `value`);
[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) removeAttribute([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`);
[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) removeAttributeNS([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`, [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `localName`);
[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)] [boolean](https://webidl.spec.whatwg.org/#idl-boolean) toggleAttribute([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`, optional [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `force`);
[boolean](https://webidl.spec.whatwg.org/#idl-boolean) hasAttribute([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`);
[boolean](https://webidl.spec.whatwg.org/#idl-boolean) hasAttributeNS([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`, [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `localName`);
Attr? getAttributeNode([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`);
Attr? getAttributeNodeNS([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`, [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `localName`);
[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)] Attr? setAttributeNode(Attr `attr`);
[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)] Attr? setAttributeNodeNS(Attr `attr`);
[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)] Attr removeAttributeNode(Attr `attr`);
ShadowRoot attachShadow(ShadowRootInit `init`);
readonly attribute ShadowRoot? shadowRoot;
readonly attribute [CustomElementRegistry](https://html.spec.whatwg.org/multipage/custom-elements.html#customelementregistry)? customElementRegistry;
Element? closest([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `selectors`);
[boolean](https://webidl.spec.whatwg.org/#idl-boolean) matches([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `selectors`);
[boolean](https://webidl.spec.whatwg.org/#idl-boolean) webkitMatchesSelector([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `selectors`); // legacy alias of .matches
HTMLCollection getElementsByTagName([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`);
HTMLCollection getElementsByTagNameNS([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`, [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `localName`);
HTMLCollection getElementsByClassName([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `classNames`);
[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)] Element? insertAdjacentElement([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `where`, Element `element`); // legacy
[undefined](https://webidl.spec.whatwg.org/#idl-undefined) insertAdjacentText([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `where`, [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `data`); // legacy
};
dictionary `ShadowRootInit` {
required ShadowRootMode `mode`;
[boolean](https://webidl.spec.whatwg.org/#idl-boolean) `delegatesFocus` = false;
[boolean](https://webidl.spec.whatwg.org/#idl-boolean) `serializable` = false;
SlotAssignmentMode `slotAssignment` = "named";
[boolean](https://webidl.spec.whatwg.org/#idl-boolean) `clonable` = false;
[CustomElementRegistry](https://html.spec.whatwg.org/multipage/custom-elements.html#customelementregistry)? `customElementRegistry`;
};
`ShadowRootInit` somewhat unusually allows both `undefined` and
`null` to be passed to its `customElementRegistry` member to allow web
developers to pass a `ShadowRoot` node instead of a dictionary to `attachShadow()`.
`Element` nodes are simply known as
elements.
Elements have an associated:
namespace Null or a non-empty string.
namespace prefix Null or a non-empty string.
local name A non-empty string.
custom element registry Null or a `[CustomElementRegistry](https://html.spec.whatwg.org/multipage/custom-elements.html#customelementregistry)` object.
custom element state "`undefined`", "`failed`", "`uncustomized`",
"`precustomized`", or "`custom`".
custom element definition Null or a [custom element definition](https://html.spec.whatwg.org/multipage/custom-elements.html#custom-element-definition).
`is` value Null or a [valid custom element name](https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name).
When an element is created, all of these values are
initialized.
An element whose custom element state is
"`uncustomized`" or "`custom`" is said to be
defined. An element whose
custom element state is "`custom`" is said to be
custom.
Whether or not an element is defined is used to determine the
behavior of the [:defined](https://drafts.csswg.org/selectors-4/#defined-pseudo) pseudo-class. Whether or not an element is custom is
used to determine the behavior of the mutation algorithms. The
"`failed`" and "`precustomized`" states are used to ensure that if a
[custom element constructor](https://html.spec.whatwg.org/multipage/custom-elements.html#custom-element-constructor) fails to execute correctly the first time, it is not executed
again by an [upgrade](https://html.spec.whatwg.org/multipage/custom-elements.html#concept-upgrade-an-element).
The following code illustrates elements in each of these four states:
` ` Elements also have an associated
shadow root (null or a
shadow root). It is null unless otherwise stated. An element is a
shadow host if its shadow root is non-null.
An element’s
qualified name is its
local name if its namespace prefix is null; otherwise its
namespace prefix, followed by "`:`", followed by its
local name.
An element’s HTML-uppercased qualified name is the return
value of these steps:
Let qualifiedName be [this](https://webidl.spec.whatwg.org/#this)’s qualified name.
If [this](https://webidl.spec.whatwg.org/#this) is in the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace) and its node document is an
HTML document, then return qualifiedName in [ASCII uppercase](https://infra.spec.whatwg.org/#ascii-uppercase).
Return qualifiedName.
User agents could optimize qualified name and
HTML-uppercased qualified name by storing them in internal slots.
To create an element, given a document document, string localName, string-or-null namespace, and
optionally a string-or-null prefix (default null), string-or-null is (default
null), boolean synchronousCustomElements (default false), and "`default`",
null, or a `[CustomElementRegistry](https://html.spec.whatwg.org/multipage/custom-elements.html#customelementregistry)` object registry (default "`default`"):
Let result be null.
If registry is "`default`", then set registry to the result
of [looking up a custom element registry](https://html.spec.whatwg.org/multipage/custom-elements.html#look-up-a-custom-element-registry) given document.
Let definition be the result of
[looking up a custom element definition](https://html.spec.whatwg.org/multipage/custom-elements.html#look-up-a-custom-element-definition) given registry,
namespace, localName, and is.
If definition is non-null, and definition’s
[name](https://html.spec.whatwg.org/multipage/custom-elements.html#concept-custom-element-definition-name) is not equal to its
[local name](https://html.spec.whatwg.org/multipage/custom-elements.html#concept-custom-element-definition-local-name) (i.e., definition represents a
[customized built-in element](https://html.spec.whatwg.org/multipage/custom-elements.html#customized-built-in-element)):
Let interface be the element interface for localName and the
[HTML namespace](https://infra.spec.whatwg.org/#html-namespace).
Set result to the result of creating an element internal given
document, interface, localName, the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace),
prefix, "`undefined`", is, and registry.
If synchronousCustomElements is true, then run this step while catching any
exceptions:
[Upgrade](https://html.spec.whatwg.org/multipage/custom-elements.html#concept-upgrade-an-element) result using definition.
If this step threw an exception exception:
[Report](https://html.spec.whatwg.org/multipage/webappapis.html#report-an-exception) exception for definition’s
[constructor](https://html.spec.whatwg.org/multipage/custom-elements.html#concept-custom-element-definition-constructor)’s corresponding JavaScript object’s
[associated realm](https://webidl.spec.whatwg.org/#dfn-associated-realm)’s [global object](https://html.spec.whatwg.org/multipage/webappapis.html#concept-realm-global).
Set result’s custom element state to
"`failed`".
Otherwise, [enqueue a custom element upgrade reaction](https://html.spec.whatwg.org/multipage/custom-elements.html#enqueue-a-custom-element-upgrade-reaction) given result and
definition.
Otherwise, if definition is non-null:
If synchronousCustomElements is true:
Let C be definition’s
[constructor](https://html.spec.whatwg.org/multipage/custom-elements.html#concept-custom-element-definition-constructor).
Let previousRegistry be the [surrounding agent](https://tc39.es/ecma262/#surrounding-agent)’s
[active custom element constructor map](https://html.spec.whatwg.org/multipage/custom-elements.html#active-custom-element-constructor-map)[C]
[with default](https://infra.spec.whatwg.org/#map-with-default) null.
[Set](https://infra.spec.whatwg.org/#map-set) the [surrounding agent](https://tc39.es/ecma262/#surrounding-agent)’s
[active custom element constructor map](https://html.spec.whatwg.org/multipage/custom-elements.html#active-custom-element-constructor-map)[C] to
registry.
Run these steps while catching any exceptions:
Set result to the result of [constructing](https://webidl.spec.whatwg.org/#construct-a-callback-function) C, with no
arguments.
[Assert](https://infra.spec.whatwg.org/#assert): one of the following is true:
result’s custom element state is "`custom`"
and its custom element definition is non-null;
result’s custom element state is
"`precustomized`"; or
result’s custom element state is neither
"`custom`" nor "`precustomized`" and its
custom element definition is null.
`customElements.define("x-example", class extends HTMLElement { constructor() { // Non-conformant: returns an existing element instead of calling super(). return document.createElement("p"); } });
document.createElement("x-example");` Here result is the `p` element, whose
custom element state is "`uncustomized`" and whose
custom element definition is null.
Assert: result’s namespace is the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace).
IDL enforces that result is an `[HTMLElement](https://html.spec.whatwg.org/multipage/dom.html#htmlelement)` object, which all
use the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace).
If result’s attribute list [is not empty](https://infra.spec.whatwg.org/#list-is-empty),
then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NotSupportedError](https://webidl.spec.whatwg.org/#notsupportederror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
If result has children, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a
"`[NotSupportedError](https://webidl.spec.whatwg.org/#notsupportederror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
If result’s parent is non-null, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a
"`[NotSupportedError](https://webidl.spec.whatwg.org/#notsupportederror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
If result’s node document is not document, then
[throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NotSupportedError](https://webidl.spec.whatwg.org/#notsupportederror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
If result’s local name is not equal to
localName, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NotSupportedError](https://webidl.spec.whatwg.org/#notsupportederror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
Set result’s namespace prefix to prefix.
Set result’s `is` value to null.
Set result’s custom element registry to
registry.
If any of these steps threw an exception exception:
[Report](https://html.spec.whatwg.org/multipage/webappapis.html#report-an-exception) exception for
definition’s [constructor](https://html.spec.whatwg.org/multipage/custom-elements.html#concept-custom-element-definition-constructor)’s corresponding
JavaScript object’s [associated realm](https://webidl.spec.whatwg.org/#dfn-associated-realm)’s [global object](https://html.spec.whatwg.org/multipage/webappapis.html#concept-realm-global).
Set result to the result of creating an element internal given
document, `[HTMLUnknownElement](https://html.spec.whatwg.org/multipage/dom.html#htmlunknownelement)`, localName, the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace),
prefix, "`failed`", null, and registry.
If previousRegistry is null, then [remove](https://infra.spec.whatwg.org/#map-remove) the
[surrounding agent](https://tc39.es/ecma262/#surrounding-agent)’s
[active custom element constructor map](https://html.spec.whatwg.org/multipage/custom-elements.html#active-custom-element-constructor-map)[C].
Otherwise, [set](https://infra.spec.whatwg.org/#map-set) the [surrounding agent](https://tc39.es/ecma262/#surrounding-agent)’s
[active custom element constructor map](https://html.spec.whatwg.org/multipage/custom-elements.html#active-custom-element-constructor-map)[C] to
previousRegistry.
Otherwise:
Set result to the result of creating an element internal given
document, `[HTMLElement](https://html.spec.whatwg.org/multipage/dom.html#htmlelement)`, localName, the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace),
prefix, "`undefined`", null, and registry.
[Enqueue a custom element upgrade reaction](https://html.spec.whatwg.org/multipage/custom-elements.html#enqueue-a-custom-element-upgrade-reaction) given result and
definition.
Otherwise:
Let interface be the element interface for localName and
namespace.
Set result to the result of creating an element internal given
document, interface, localName, namespace,
prefix, "`uncustomized`", is, and registry.
If namespace is the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace), and either localName is a
[valid custom element name](https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name) or is is non-null, then set result’s
custom element state to "`undefined`".
Return result.
To create an element internal given a document document, an
interface interface a string localName, a string-or-null namespace,
a string-or-null prefix, a string state, a string-or-null is, and
null or a `[CustomElementRegistry](https://html.spec.whatwg.org/multipage/custom-elements.html#customelementregistry)` object registry:
Let element be the result of creating a node that implements
interface, given document.
Set element’s namespace to namespace,
namespace prefix to prefix, local name to
localName, custom element registry to registry,
custom element state to state,
custom element definition to null, and `is` value
to is.
[Assert](https://infra.spec.whatwg.org/#assert): element’s attribute list [is empty](https://infra.spec.whatwg.org/#list-is-empty).
Return element.
Elements also have an
attribute list, which is a
[list](https://infra.spec.whatwg.org/#list) exposed through a `NamedNodeMap`. Unless explicitly given when an
element is created, its attribute list [is empty](https://infra.spec.whatwg.org/#list-is-empty).
An element has an attribute A if its attribute list [contains](https://infra.spec.whatwg.org/#list-contain) A.
This and other specifications may define
attribute change steps for
elements. The algorithm is passed element, localName,
oldValue, value, and namespace.
To handle attribute changes for an attribute attribute with
element, oldValue, and newValue, run these steps:
Queue a mutation record of "`attributes`" for element with
attribute’s local name, attribute’s
namespace, oldValue, « », « », null, and null.
If element is custom, then
[enqueue a custom element callback reaction](https://html.spec.whatwg.org/multipage/custom-elements.html#enqueue-a-custom-element-callback-reaction) with element, callback name
"`attributeChangedCallback`", and « attribute’s local name,
oldValue, newValue, attribute’s namespace ».
Run the attribute change steps with element, attribute’s
local name, oldValue, newValue, and attribute’s
namespace.
To change an
attribute attribute to value:
Let oldValue be attribute’s value.
Set attribute’s value to value.
Handle attribute changes for attribute with attribute’s
element, oldValue, and value.
To append an
attribute attribute to an element element:
[Append](https://infra.spec.whatwg.org/#list-append) attribute to element’s
attribute list.
Set attribute’s element to element.
Set attribute’s node document to element’s
node document.
Handle attribute changes for attribute with element, null, and
attribute’s value.
To remove an
attribute attribute:
Let element be attribute’s element.
[Remove](https://infra.spec.whatwg.org/#list-remove) attribute from element’s attribute
list.
Set attribute’s element to null.
Handle attribute changes for attribute with element,
attribute’s value, and null.
To replace an
attribute oldAttribute with an attribute newAttribute:
Let element be oldAttribute’s element.
[Replace](https://infra.spec.whatwg.org/#list-replace) oldAttribute by newAttribute in
element’s attribute list.
Set newAttribute’s element to element.
Set newAttribute’s node document to element’s
node document.
Set oldAttribute’s element to null.
Handle attribute changes for oldAttribute with element,
oldAttribute’s value, and newAttribute’s
value.
To get an attribute by name given a
string qualifiedName and an element element:
If element is in the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace) and its node document
is an HTML document, then set qualifiedName to qualifiedName in
[ASCII lowercase](https://infra.spec.whatwg.org/#ascii-lowercase).
Return the first attribute in element’s attribute list
whose qualified name is qualifiedName; otherwise null.
To
get an attribute by namespace and local name
given null or a string namespace, a string localName, and an
element element:
If namespace is the empty string, then set it to null.
Return the attribute in element’s attribute list whose
namespace is namespace and local name is
localName, if any; otherwise null.
To get an attribute value given an
element element, a string localName, and an optional null or
string namespace (default null):
Let attr be the result of
getting an attribute given
namespace, localName, and element.
If attr is null, then return the empty string.
Return attr’s value.
To set an attribute given an
attribute attr and an element element:
Let verifiedValue be the result of calling
[get trusted type compliant attribute value](https://w3c.github.io/trusted-types/dist/spec/#get-trusted-type-compliant-attribute-value) with attr’s
local name, attr’s namespace, element, and
attr’s value. [TRUSTED-TYPES] If attr’s element is neither null nor element,
[throw](https://webidl.spec.whatwg.org/#dfn-throw) an "`[InUseAttributeError](https://webidl.spec.whatwg.org/#inuseattributeerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
Let oldAttr be the result of
getting an attribute given
attr’s namespace, attr’s local name, and
element.
If oldAttr is attr, return attr.
Set attr’s value to verifiedValue.
If oldAttr is non-null, then replace oldAttr with attr.
Otherwise, append attr to element.
Return oldAttr.
To set an attribute value given an
element element, a string localName, a string value,
an optional null or string prefix (default null), and an optional null or string
namespace (default null):
Let attribute be the result of
getting an attribute given
namespace, localName, and element.
If attribute is null, then append the result of
creating an attribute given element’s node document,
localName, namespace, prefix, and value to
element, and then return.
Change attribute to value.
To remove an attribute by name
given a string qualifiedName and an element element:
Let attr be the result of
getting an attribute given qualifiedName and
element.
If attr is non-null, then remove attr.
Return attr.
To
remove an attribute by namespace and local name
given null or a string namespace, a string localName, and an
element element:
Let attr be the result of
getting an attribute given
namespace, localName, and element.
If attr is non-null, then remove attr.
Return attr.
An element can have an associated
unique identifier (ID) Historically elements could have multiple identifiers e.g., by using
the HTML `id` attribute and a DTD. This specification makes ID
a concept of the DOM and allows for only one per element, given by an
`id` attribute.
Use these attribute change steps to update an element’s
ID:
If localName is `id`, namespace is null, and
value is null or the empty string, then unset element’s
ID.
Otherwise, if localName is `id`, namespace is null, then
set element’s ID to value.
While this specification defines requirements for `class`,
`id`, and `slot` attributes on any element, it makes no
claims as to whether using them is conforming or not.
A node’s parent of type `Element` is known as its
parent element. If the node has a
parent of a different type, its
parent element is null.
namespace = element . `namespaceURI` Returns the namespace.
prefix = element . `prefix` Returns the
namespace prefix.
localName = element . `localName` Returns the
local name.
qualifiedName = element . `tagName` Returns the HTML-uppercased qualified name.
The `namespaceURI` getter steps are to return
[this](https://webidl.spec.whatwg.org/#this)’s namespace.
The `prefix` getter steps are to return
[this](https://webidl.spec.whatwg.org/#this)’s namespace prefix.
The `localName` getter steps are to return
[this](https://webidl.spec.whatwg.org/#this)’s local name.
The `tagName` getter steps are to return
[this](https://webidl.spec.whatwg.org/#this)’s HTML-uppercased qualified name.
`element . id [ = value ]` Returns the value of element’s `id` content attribute. Can be set to
change it.
`element . className [ = value ]` Returns the value of element’s `class` content attribute. Can be set
to change it.
`element . classList` Allows for manipulation of element’s `class` content attribute as a
set of whitespace-separated tokens through a `DOMTokenList` object.
`element . slot [ = value ]` Returns the value of element’s `slot` content attribute. Can be set to
change it.
IDL attributes that are defined to reflect a string
name, must have these getter and setter steps:
getter steps
Return the result of running get an attribute value given [this](https://webidl.spec.whatwg.org/#this) and
name.
setter steps
Set an attribute value for [this](https://webidl.spec.whatwg.org/#this) using name and the given value.
The `id` attribute must reflect
"`id`".
The `className` attribute must
reflect "`class`".
The `classList` getter steps are to return a
`DOMTokenList` object whose associated element is [this](https://webidl.spec.whatwg.org/#this) and whose associated
attribute’s local name is `class`. The token set of this
particular `DOMTokenList` object are also known as the element’s
classes.
The `slot` attribute must reflect
"`slot`".
`id`, `class`, and `slot` are effectively
superglobal attributes as they can appear on any element, regardless of that element’s
namespace.
`element . hasAttributes()` Returns true if element has attributes; otherwise false.
`element . getAttributeNames()` Returns the qualified names of all element’s attributes.
Can contain duplicates.
`element . getAttribute(qualifiedName)` Returns element’s first attribute whose qualified name is
qualifiedName, and null if there is no such attribute otherwise.
`element . getAttributeNS(namespace, localName)` Returns element’s attribute whose namespace is
namespace and local name is localName, and null if there is
no such attribute otherwise.
`element . setAttribute(qualifiedName, value)` Sets the value of element’s first attribute whose
qualified name is qualifiedName to value.
`element . setAttributeNS(namespace, localName, value)` Sets the value of element’s attribute whose
namespace is namespace and local name is
localName to value.
`element . removeAttribute(qualifiedName)` Removes element’s first attribute whose qualified name is
qualifiedName.
`element . removeAttributeNS(namespace, localName)` Removes element’s attribute whose namespace is
namespace and local name is localName.
`element . toggleAttribute(qualifiedName [, force])` If force is not given, "toggles" qualifiedName, removing it if it is
present and adding it if it is not present. If force is true, adds
qualifiedName. If force is false, removes qualifiedName.
Returns true if qualifiedName is now present; otherwise false.
`element . hasAttribute(qualifiedName)` Returns true if element has an attribute whose
qualified name is qualifiedName; otherwise false.
`element . hasAttributeNS(namespace, localName)` Returns true if element has an attribute whose namespace
is namespace and local name is localName.
The `hasAttributes()` method steps are to return false
if [this](https://webidl.spec.whatwg.org/#this)’s attribute list [is empty](https://infra.spec.whatwg.org/#list-is-empty); otherwise true.
The `attributes` getter steps are to return the
associated `NamedNodeMap`.
The `getAttributeNames()` method steps are to return the
qualified names of the attributes in [this](https://webidl.spec.whatwg.org/#this)’s
attribute list, in order; otherwise a new [list](https://infra.spec.whatwg.org/#list).
These are not guaranteed to be unique.
The `getAttribute(qualifiedName)` method
steps are:
Let attr be the result of
getting an attribute given qualifiedName and
[this](https://webidl.spec.whatwg.org/#this).
If attr is null, return null.
Return attr’s value.
The
`getAttributeNS(namespace, localName)`
method steps are:
Let attr be the result of
getting an attribute given
namespace, localName, and [this](https://webidl.spec.whatwg.org/#this).
If attr is null, return null.
Return attr’s value.
The
`setAttribute(qualifiedName, value)`
method steps are:
If qualifiedName is not a valid attribute local name, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an
"`[InvalidCharacterError](https://webidl.spec.whatwg.org/#invalidcharactererror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
Despite the parameter naming,
qualifiedName is only used as a qualified name if an attribute already
exists with that qualified name. Otherwise, it is used as the local name of the new
attribute. We only need to validate it for the latter case.
If [this](https://webidl.spec.whatwg.org/#this) is in the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace) and its node document is an
HTML document, then set qualifiedName to qualifiedName in
[ASCII lowercase](https://infra.spec.whatwg.org/#ascii-lowercase).
Let verifiedValue be the result of calling
[get trusted type compliant attribute value](https://w3c.github.io/trusted-types/dist/spec/#get-trusted-type-compliant-attribute-value) with qualifiedName, null, [this](https://webidl.spec.whatwg.org/#this),
and value. [TRUSTED-TYPES] Let attribute be the first attribute in [this](https://webidl.spec.whatwg.org/#this)’s
attribute list whose qualified name is qualifiedName,
and null otherwise.
If attribute is non-null, then change attribute to verifiedValue and return.
Set attribute to the result of creating an attribute given [this](https://webidl.spec.whatwg.org/#this)’s
node document, qualifiedName, null, null, and verifiedValue.
Append attribute to [this](https://webidl.spec.whatwg.org/#this).
The
`setAttributeNS(namespace, qualifiedName, value)`
method steps are:
Let (namespace, prefix, localName) be the result of
validating and extracting namespace and
qualifiedName given "`attribute`".
Let verifiedValue be the result of calling
[get trusted type compliant attribute value](https://w3c.github.io/trusted-types/dist/spec/#get-trusted-type-compliant-attribute-value) with localName, namespace,
[this](https://webidl.spec.whatwg.org/#this), and value. [TRUSTED-TYPES] Set an attribute value for [this](https://webidl.spec.whatwg.org/#this) using localName,
verifiedValue, prefix, and namespace.
The
`removeAttribute(qualifiedName)`
method steps are to remove an attribute given
qualifiedName and [this](https://webidl.spec.whatwg.org/#this), and then return undefined.
The
`removeAttributeNS(namespace, localName)`
method steps are to remove an attribute
given namespace, localName, and [this](https://webidl.spec.whatwg.org/#this), and then return undefined.
The `hasAttribute(qualifiedName)` method
steps are:
If [this](https://webidl.spec.whatwg.org/#this) is in the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace) and its node document is an
HTML document, then set qualifiedName to qualifiedName in
[ASCII lowercase](https://infra.spec.whatwg.org/#ascii-lowercase).
Return true if [this](https://webidl.spec.whatwg.org/#this) has an attribute whose
qualified name is qualifiedName; otherwise false.
The
`toggleAttribute(qualifiedName, force)`
method steps are:
If qualifiedName is not a valid attribute local name, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an
"`[InvalidCharacterError](https://webidl.spec.whatwg.org/#invalidcharactererror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
See the discussion above about why
we validate it as a local name, instead of a qualified name.
If [this](https://webidl.spec.whatwg.org/#this) is in the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace) and its node document is an
HTML document, then set qualifiedName to qualifiedName in
[ASCII lowercase](https://infra.spec.whatwg.org/#ascii-lowercase).
Let attribute be the first attribute in [this](https://webidl.spec.whatwg.org/#this)’s
attribute list whose qualified name is qualifiedName,
and null otherwise.
If attribute is null:
If force is not given or is true, then append
the result of creating an attribute given [this](https://webidl.spec.whatwg.org/#this)’s node document and
qualifiedName to [this](https://webidl.spec.whatwg.org/#this), and then return true.
Return false.
If force is not given or is false,
remove an attribute given qualifiedName and
[this](https://webidl.spec.whatwg.org/#this), and then return false.
Return true.
The
`hasAttributeNS(namespace, localName)`
method steps are:
If namespace is the empty string, then set it to null.
Return true if [this](https://webidl.spec.whatwg.org/#this) has an attribute whose
namespace is namespace and local name is
localName; otherwise false.
The `getAttributeNode(qualifiedName)` method
steps are to return the result of getting an attribute given
qualifiedName and [this](https://webidl.spec.whatwg.org/#this).
The
`getAttributeNodeNS(namespace, localName)`
method steps are to return the result of
getting an attribute given
namespace, localName, and [this](https://webidl.spec.whatwg.org/#this).
The `setAttributeNode(attr)` and
`setAttributeNodeNS(attr)` methods steps are to
return the result of setting an attribute given attr and
[this](https://webidl.spec.whatwg.org/#this).
The `removeAttributeNode(attr)` method steps
are:
If [this](https://webidl.spec.whatwg.org/#this)’s attribute list does not [contain](https://infra.spec.whatwg.org/#list-contain) attr, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NotFoundError](https://webidl.spec.whatwg.org/#notfounderror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
Remove attr.
Return attr.
`shadow = element . `attachShadow(init)`` Creates a shadow root for element and returns it.
`shadow = element . `shadowRoot`` Returns element’s shadow root, if any, and if
shadow root’s mode is "`open`"; otherwise null.
A valid shadow host name is:
a [valid custom element name](https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name) "`article`",
"`aside`",
"`blockquote`",
"`body`",
"`div`",
"`footer`",
"`h1`",
"`h2`",
"`h3`",
"`h4`",
"`h5`",
"`h6`",
"`header`",
"`main`",
"`nav`",
"`p`",
"`section`", or
"`span`"
This list is intentionally limited so that built-in elements can gain internal
shadow trees over time as needed.
The `attachShadow(init)` method steps are:
Let registry be [this](https://webidl.spec.whatwg.org/#this)’s node document’s
custom element registry.
If init["`customElementRegistry`"] [exists](https://infra.spec.whatwg.org/#map-exists), then
set registry to it.
If registry is non-null, registry’s
[is scoped](https://html.spec.whatwg.org/multipage/custom-elements.html#is-scoped) is false, and registry is not [this](https://webidl.spec.whatwg.org/#this)’s
node document’s custom element registry, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a
"`[NotSupportedError](https://webidl.spec.whatwg.org/#notsupportederror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
Run attach a shadow root with [this](https://webidl.spec.whatwg.org/#this),
init["`mode`"],
init["`delegatesFocus`"],
init["`serializable`"],
init["`slotAssignment`"],
init["`clonable`"], and registry.
Return [this](https://webidl.spec.whatwg.org/#this)’s shadow root.
To attach a shadow root, given an element element, a string mode, a boolean delegatesFocus, a boolean
serializable, a string slotAssignment, a boolean clonable, and null
or a `[CustomElementRegistry](https://html.spec.whatwg.org/multipage/custom-elements.html#customelementregistry)` object registry:
If element’s namespace is not the [HTML namespace](https://infra.spec.whatwg.org/#html-namespace),
then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NotSupportedError](https://webidl.spec.whatwg.org/#notsupportederror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
If element’s local name is not a
valid shadow host name, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NotSupportedError](https://webidl.spec.whatwg.org/#notsupportederror)`"
`[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
If element’s local name is a [valid custom element name](https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name), or
element’s `is` value is non-null:
Let definition be the result of [looking up a custom element definition](https://html.spec.whatwg.org/multipage/custom-elements.html#look-up-a-custom-element-definition)
given element’s custom element registry, its
namespace, its local name, and its
`is` value.
If definition is non-null and definition’s
[disable shadow](https://html.spec.whatwg.org/multipage/custom-elements.html#concept-custom-element-definition-disable-shadow) is true, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a
"`[NotSupportedError](https://webidl.spec.whatwg.org/#notsupportederror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
If element is a shadow host:
Let currentShadowRoot be element’s shadow root.
If any of the following are true:
currentShadowRoot’s declarative is false; or
currentShadowRoot’s mode is not mode,
then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NotSupportedError](https://webidl.spec.whatwg.org/#notsupportederror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
Remove all of currentShadowRoot’s children, in
tree order.
Set currentShadowRoot’s declarative to false.
Return.
Let shadow be the result of creating a node that implements
`ShadowRoot`, given element’s node document.
Set shadow’s host to element.
Set shadow’s mode to mode.
Set shadow’s delegates focus to delegatesFocus.
If element’s custom element state is
"`precustomized`" or "`custom`", then set shadow’s
available to element internals to true.
Set shadow’s declarative to false.
Set shadow’s serializable to serializable.
Set shadow’s slot assignment to slotAssignment.
Set shadow’s clonable to clonable.
Set shadow’s custom element registry to
registry.
Set element’s shadow root to shadow.
The `shadowRoot` getter steps are:
Let shadow be [this](https://webidl.spec.whatwg.org/#this)’s shadow root.
If shadow is null or its mode is "`closed`",
then return null.
Return shadow.
`registry = element . `customElementRegistry`` Returns element’s `[CustomElementRegistry](https://html.spec.whatwg.org/multipage/custom-elements.html#customelementregistry)` object, if any; otherwise null.
The `customElementRegistry` getter steps are to
return [this](https://webidl.spec.whatwg.org/#this)’s custom element registry.
`element . `closest(selectors)`` Returns the first (starting at element)
inclusive ancestor that matches
selectors, and null otherwise.
`element . `matches(selectors)`` Returns true if matching selectors against element’s root
yields element; otherwise false.
The `closest(selectors)` method steps are:
Let selector be the result of [parse a selector](https://drafts.csswg.org/selectors-4/#parse-a-selector) from selectors.
[SELECTORS4] If selector is failure, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[SyntaxError](https://webidl.spec.whatwg.org/#syntaxerror)`"
`[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
Let elements be [this](https://webidl.spec.whatwg.org/#this)’s inclusive ancestors that are
elements, in reverse tree order.
For each element of elements: if
[match a selector against an element](https://drafts.csswg.org/selectors-4/#match-a-selector-against-an-element), using selector, element, and
[scoping root](https://drafts.csswg.org/selectors-4/#scoping-root) [this](https://webidl.spec.whatwg.org/#this), returns success, return element. [SELECTORS4] Return null.
The `matches(selectors)` and
`webkitMatchesSelector(selectors)` method steps
are:
Let selector be the result of [parse a selector](https://drafts.csswg.org/selectors-4/#parse-a-selector) from selectors.
[SELECTORS4] If selector is failure, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[SyntaxError](https://webidl.spec.whatwg.org/#syntaxerror)`"
`[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
If the result of [match a selector against an element](https://drafts.csswg.org/selectors-4/#match-a-selector-against-an-element), using selector,
[this](https://webidl.spec.whatwg.org/#this), and [scoping root](https://drafts.csswg.org/selectors-4/#scoping-root) [this](https://webidl.spec.whatwg.org/#this), returns success, then return true; otherwise,
return false. [SELECTORS4] The `getElementsByTagName(qualifiedName)`
method steps are to return the list of elements with qualified name qualifiedName
for [this](https://webidl.spec.whatwg.org/#this).
The
`getElementsByTagNameNS(namespace, localName)`
method steps are to return the list of elements with namespace namespace and local
name localName for [this](https://webidl.spec.whatwg.org/#this).
The `getElementsByClassName(classNames)`
method steps are to return the list of elements with class names classNames for
[this](https://webidl.spec.whatwg.org/#this).
To insert adjacent, given an element element, string
where, and a node node, run the steps associated with the first
[ASCII case-insensitive](https://infra.spec.whatwg.org/#ascii-case-insensitive) match for where:
"`beforebegin`"
If element’s parent is null, return null.
Return the result of pre-inserting node into element’s
parent before element.
"`afterbegin`"
Return the result of pre-inserting node into element before
element’s first child.
"`beforeend`"
Return the result of pre-inserting node into element before
null.
"`afterend`"
If element’s parent is null, return null.
Return the result of pre-inserting node into element’s
parent before element’s next sibling.
Otherwise
[Throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[SyntaxError](https://webidl.spec.whatwg.org/#syntaxerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
The
`insertAdjacentElement(where, element)`
method steps are to return the result of running insert adjacent, give [this](https://webidl.spec.whatwg.org/#this),
where, and element.
The
`insertAdjacentText(where, data)`
method steps are:
Let text be the result of creating a text node given [this](https://webidl.spec.whatwg.org/#this)’s
node document and data.
Run insert adjacent, given [this](https://webidl.spec.whatwg.org/#this), where, and text.
This method returns nothing because it existed before we had a chance to design it.
4.9.1. Interface `NamedNodeMap` [[Exposed](https://webidl.spec.whatwg.org/#Exposed)=Window,
[LegacyUnenumerableNamedProperties](https://webidl.spec.whatwg.org/#LegacyUnenumerableNamedProperties)]
interface `NamedNodeMap` {
readonly attribute [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) length;
getter Attr? item([unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `index`);
getter Attr? getNamedItem([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`);
Attr? getNamedItemNS([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`, [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `localName`);
[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)] Attr? setNamedItem(Attr `attr`);
[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)] Attr? setNamedItemNS(Attr `attr`);
[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)] Attr removeNamedItem([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `qualifiedName`);
[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)] Attr removeNamedItemNS([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `namespace`, [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `localName`);
};
A `NamedNodeMap` has an associated
element (an
element).
A `NamedNodeMap` object’s
attribute list is its
element’s
attribute list.
A `NamedNodeMap` object’s [supported property indices](https://webidl.spec.whatwg.org/#dfn-supported-property-indices) are the numbers in the
range zero to its attribute list’s [size](https://infra.spec.whatwg.org/#list-size) − 1, unless
the attribute list [is empty](https://infra.spec.whatwg.org/#list-is-empty), in which case there are no
[supported property indices](https://webidl.spec.whatwg.org/#dfn-supported-property-indices).
The `length` getter steps are to return
the attribute list’s [size](https://infra.spec.whatwg.org/#list-size).
The `item(index)` method steps are:
If index is equal to or greater than [this](https://webidl.spec.whatwg.org/#this)’s
attribute list’s [size](https://infra.spec.whatwg.org/#list-size), then return null.
Otherwise, return [this](https://webidl.spec.whatwg.org/#this)’s attribute list[index].
A `NamedNodeMap` object’s [supported property names](https://webidl.spec.whatwg.org/#dfn-supported-property-names) are the return value of running these
steps:
Let names be the qualified names of the attributes in this
`NamedNodeMap` object’s attribute list, with duplicates omitted, in
order.
If this `NamedNodeMap` object’s element is in the
[HTML namespace](https://infra.spec.whatwg.org/#html-namespace) and its node document is an HTML document, then
[for each](https://infra.spec.whatwg.org/#list-iterate) name of names:
Let lowercaseName be name, in [ASCII lowercase](https://infra.spec.whatwg.org/#ascii-lowercase).
If lowercaseName is not equal to name, remove name from
names.
Return names.
The `getNamedItem(qualifiedName)`
method steps are to return the result of getting an attribute
given qualifiedName and element.
The
`getNamedItemNS(namespace, localName)`
method steps are to return the result of
getting an attribute given
namespace, localName, and element.
The `setNamedItem(attr)` and
`setNamedItemNS(attr)` method steps are
to return the result of setting an attribute given attr and
element.
The `removeNamedItem(qualifiedName)`
method steps are:
Let attr be the result of
removing an attribute given
qualifiedName and element.
If attr is null, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NotFoundError](https://webidl.spec.whatwg.org/#notfounderror)`"
`[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
Return attr.
The
`removeNamedItemNS(namespace, localName)`
method steps are:
Let attr be the result of
removing an attribute given
namespace, localName, and element.
If attr is null, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NotFoundError](https://webidl.spec.whatwg.org/#notfounderror)`"
`[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
Return attr.
4.9.2. Interface `Attr` [[Exposed](https://webidl.spec.whatwg.org/#Exposed)=Window]
interface `Attr` : Node {
readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? namespaceURI;
readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? prefix;
readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) localName;
readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) name;
[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)] attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) value;
readonly attribute Element? ownerElement;
readonly attribute [boolean](https://webidl.spec.whatwg.org/#idl-boolean) specified; // historical; always returns true
}; `Attr` nodes are simply known as
attributes. They are sometimes referred
to as *content attributes* to avoid confusion with IDL attributes.
Attributes have a
namespace (null or a non-empty string),
namespace prefix (null or a non-empty string),
local name (a non-empty string),
value (a string), and
element (null or an
element). If designed today they would just have a name and value. ☹
An attribute’s
qualified name is its
local name if its namespace prefix is null, and its
namespace prefix, followed by "`:`", followed by its
local name, otherwise.
User agents could have this as an internal slot as an optimization.
To create an attribute given a document document, a
string localName, and optionally a string-or-null namespace (default null), a
string-or-null prefix (default null), and a string value (default the empty
string):
Let attribute be the result of creating a node that implements `Attr`,
given document.
Set attribute’s namespace to namespace,
namespace prefix to prefix, local name to
localName, and value to value.
Return attribute.
An
`A` attribute
is an attribute whose
local name is
`A` and whose
namespace and
namespace prefix are
null.
The `namespaceURI` getter steps are to return
[this](https://webidl.spec.whatwg.org/#this)’s namespace.
The `prefix` getter steps are to return [this](https://webidl.spec.whatwg.org/#this)’s
namespace prefix.
The `localName` getter steps are to return
[this](https://webidl.spec.whatwg.org/#this)’s local name.
The `name` getter steps are to return [this](https://webidl.spec.whatwg.org/#this)’s
qualified name.
The `value` getter steps are to return [this](https://webidl.spec.whatwg.org/#this)’s
value.
To set an existing attribute value, given an attribute attribute and
string value, run these steps:
If attribute’s element is null, then set attribute’s
value to value and return.
Let element be attribute’s element.
Let verifiedValue be the result of calling
[get trusted type compliant attribute value](https://w3c.github.io/trusted-types/dist/spec/#get-trusted-type-compliant-attribute-value) with attribute’s
local name, attribute’s namespace, element,
and value. [TRUSTED-TYPES] If attribute’s element is null, then set attribute’s
value to verifiedValue and return.
Change attribute to verifiedValue.
The `value` setter steps are to set an existing attribute value with [this](https://webidl.spec.whatwg.org/#this)
and the given value.
The `ownerElement` getter steps are to return
[this](https://webidl.spec.whatwg.org/#this)’s element.
The `specified` getter steps are to return true.
4.10. Interface `CharacterData` [[Exposed](https://webidl.spec.whatwg.org/#Exposed)=Window]
interface `CharacterData` : Node {
attribute [[LegacyNullToEmptyString](https://webidl.spec.whatwg.org/#LegacyNullToEmptyString)] [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) data;
readonly attribute [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) length;
[DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) substringData([unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `offset`, [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `count`);
[undefined](https://webidl.spec.whatwg.org/#idl-undefined) appendData([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `data`);
[undefined](https://webidl.spec.whatwg.org/#idl-undefined) insertData([unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `offset`, [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `data`);
[undefined](https://webidl.spec.whatwg.org/#idl-undefined) deleteData([unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `offset`, [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `count`);
[undefined](https://webidl.spec.whatwg.org/#idl-undefined) replaceData([unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `offset`, [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `count`, [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `data`);
};
`CharacterData` is an abstract interface. You cannot get a direct instance of it. It
is used by `Text`, `ProcessingInstruction`, and `Comment` nodes.
Each node inheriting from the `CharacterData` interface has an associated mutable
string called data.
To replace data of a node node
with an integer offset, integer count, string data, and an optional
boolean piAttributesAlreadyUpdated (default false):
Let length be node’s length.
If offset is greater than length, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an
"`[IndexSizeError](https://webidl.spec.whatwg.org/#indexsizeerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
If offset + count is greater than length, then set
count to length − offset.
Queue a mutation record of "`characterData`" for node with
null, null, node’s data, « », « », null, and null.
Insert data into node’s data after
offset [code units](https://infra.spec.whatwg.org/#code-unit).
Let deleteOffset be offset + data’s
[length](https://infra.spec.whatwg.org/#string-length).
Starting from deleteOffset [code units](https://infra.spec.whatwg.org/#code-unit), remove count [code units](https://infra.spec.whatwg.org/#code-unit) from node’s data.
For each live range whose start node is node and
start offset is greater than offset but less than or equal to
offset + count: set its start offset to offset.
For each live range whose end node is node and
end offset is greater than offset but less than or equal to
offset + count: set its end offset to offset.
For each live range whose start node is node and
start offset is greater than offset + count: increase its
start offset by data’s [length](https://infra.spec.whatwg.org/#string-length) and decrease it by
count.
For each live range whose end node is node and
end offset is greater than offset + count: increase its
end offset by data’s [length](https://infra.spec.whatwg.org/#string-length) and decrease it by
count.
If node is a `ProcessingInstruction` node and
piAttributesAlreadyUpdated is false, then update attributes from data given
node.
If node’s parent is non-null, then run the
children changed steps for node’s parent.
To
substring data
of a node node with an integer offset and integer
count:
Let length be node’s length.
If offset is greater than length, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an
"`[IndexSizeError](https://webidl.spec.whatwg.org/#indexsizeerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
If offset + count is greater than length, then return a
string whose value is the [code units](https://infra.spec.whatwg.org/#code-unit) from the offsetth [code unit](https://infra.spec.whatwg.org/#code-unit) to the end of node’s data.
Return a string whose value is the [code units](https://infra.spec.whatwg.org/#code-unit) from the offsetth [code unit](https://infra.spec.whatwg.org/#code-unit) to the offset+countth [code unit](https://infra.spec.whatwg.org/#code-unit) in
node’s data.
The `data` getter steps are to return
[this](https://webidl.spec.whatwg.org/#this)’s data. Its setter steps are to replace data of
[this](https://webidl.spec.whatwg.org/#this) with 0, [this](https://webidl.spec.whatwg.org/#this)’s length, and the given value.
The `length` getter steps are to return
[this](https://webidl.spec.whatwg.org/#this)’s length.
The
`substringData(offset, count)`
method steps are to return the result of substringing data of [this](https://webidl.spec.whatwg.org/#this) with
offset and count.
The `appendData(data)` method steps are
to replace data of [this](https://webidl.spec.whatwg.org/#this) with [this](https://webidl.spec.whatwg.org/#this)’s length, 0, and
data.
The
`insertData(offset, data)`
method steps are to replace data of [this](https://webidl.spec.whatwg.org/#this) with offset, 0, and
data.
The
`deleteData(offset, count)`
method steps are to replace data of [this](https://webidl.spec.whatwg.org/#this) with offset, count, and
the empty string.
The
`replaceData(offset, count, data)`
method steps are to replace data of [this](https://webidl.spec.whatwg.org/#this) with offset, count, and
data.
4.11. Interface `Text` [[Exposed](https://webidl.spec.whatwg.org/#Exposed)=Window]
interface `Text` : CharacterData {
constructor(optional [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `data` = "");
[[NewObject](https://webidl.spec.whatwg.org/#NewObject)] Text splitText([unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `offset`);
readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) wholeText;
};
`text = new Text([data = ""])` Returns a new `Text` node whose
data is data.
`text . `splitText(offset)`` Splits data at the given
offset and returns the remainder as `Text` node.
`text . `wholeText`` Returns the combined data of all direct
`Text` node siblings.
An exclusive `Text` node is a `Text` node that is not a
`CDATASection` node.
The contiguous `Text` nodes of a node node are
node, node’s previous sibling `Text` node, if any, and
its contiguous `Text` nodes, and node’s next sibling `Text` node, if any, and its contiguous `Text` nodes, avoiding any
duplicates.
The contiguous exclusive `Text` nodes of a node node
are node, node’s previous sibling exclusive `Text` node, if any, and its
contiguous exclusive `Text` nodes, and node’s
next sibling exclusive `Text` node, if any, and its
contiguous exclusive `Text` nodes, avoiding any duplicates.
The child text content of a node node is the [concatenation](https://infra.spec.whatwg.org/#string-concatenate) of the data of all
the `Text` node children of node, in tree order.
The descendant text content of a
node node is the [concatenation](https://infra.spec.whatwg.org/#string-concatenate) of the
data of all the `Text` node descendants of
node, in tree order.
To create a text node given a document document and a
string data:
Let text be the result of creating a node that implements `Text`, given
document.
Set text’s data to data.
Return text.
The `new Text(data)`
constructor steps are to set [this](https://webidl.spec.whatwg.org/#this)’s data to data and
[this](https://webidl.spec.whatwg.org/#this)’s node document to [current global object](https://html.spec.whatwg.org/multipage/webappapis.html#current-global-object)’s
[associated `Document`](https://html.spec.whatwg.org/multipage/nav-history-apis.html#concept-document-window).
To split a `Text` node node with integer offset:
Let length be node’s length.
If offset is greater than length, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an
"`[IndexSizeError](https://webidl.spec.whatwg.org/#indexsizeerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
Let count be length − offset.
Let newData be the result of substringing data of node with
offset and count.
Let newNode be the result of creating a text node given node’s
node document and newData.
Let parent be node’s parent.
If parent is non-null:
Insert newNode into parent before node’s
next sibling.
For each live range whose start node is node and
start offset is greater than offset, set its
start node to newNode and decrease its start offset
by offset.
For each live range whose end node is node and
end offset is greater than offset, set its end node
to newNode and decrease its end offset by offset.
For each live range whose start node is parent and
start offset is equal to the index of node plus 1,
increase its start offset by 1.
For each live range whose end node is parent and
end offset is equal to the index of node plus 1,
increase its end offset by 1.
Replace data of node with offset, count, and
the empty string.
Return newNode.
The `splitText(offset)` method steps are to
split [this](https://webidl.spec.whatwg.org/#this) with offset offset.
The `wholeText` getter steps are to return the
[concatenation](https://infra.spec.whatwg.org/#string-concatenate) of the data of the
contiguous `Text` nodes of [this](https://webidl.spec.whatwg.org/#this), in tree order.
4.12. Interface `CDATASection` [[Exposed](https://webidl.spec.whatwg.org/#Exposed)=Window]
interface `CDATASection` : Text {
}; 4.13. Interface `ProcessingInstruction` [[Exposed](https://webidl.spec.whatwg.org/#Exposed)=Window]
interface `ProcessingInstruction` : CharacterData {
constructor([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `target`, optional [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `data` = "");
readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) target;
[boolean](https://webidl.spec.whatwg.org/#idl-boolean) hasAttributes();
[sequence](https://webidl.spec.whatwg.org/#idl-sequence)<[DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)> getAttributeNames();
[DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? getAttribute([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `name`);
[undefined](https://webidl.spec.whatwg.org/#idl-undefined) setAttribute([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `name`, [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `value`);
[undefined](https://webidl.spec.whatwg.org/#idl-undefined) removeAttribute([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `name`);
[boolean](https://webidl.spec.whatwg.org/#idl-boolean) toggleAttribute([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `name`, optional [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `force`);
[boolean](https://webidl.spec.whatwg.org/#idl-boolean) hasAttribute([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `name`);
};
`pi = new ProcessingInstruction(target [, data = ""])` Returns a new `ProcessingInstruction` node whose
target is target and
data is data.
`pi . `target`` Returns the target.
`pi . hasAttributes()` Returns true if pi has attributes; otherwise false.
`pi . getAttributeNames()` Returns the names of all of pi’s attributes. Cannot contain duplicates.
`pi . getAttribute(name)` Returns the value of pi’s attribute named name, and null if there is
no such attribute.
`pi . setAttribute(name, value)` Sets pi’s attribute named name to value.
`pi . removeAttribute(name)` Removes pi’s attribute named name.
`pi . toggleAttribute(name [, force])` If force is not given, "toggles" name, removing it if it is
present and adding it if it is not present. If force is true, adds
name. If force is false, removes name.
Returns true if name is now present; otherwise false.
`pi . hasAttribute(name)` Returns true if pi has an attribute named name; otherwise false.
`ProcessingInstruction` nodes have an associated
target.
`ProcessingInstruction` nodes have an associated
attribute map, which is a
[map](https://infra.spec.whatwg.org/#ordered-map), initially empty.
To create a processing instruction node given a document document, a string target, and a string data:
Let pi be the result of creating a node that implements
`ProcessingInstruction`, given document.
Initialize pi with target and
data.
Return pi.
To initialize a `ProcessingInstruction` node pi, with target and data:
If target does not match the `[Name](https://www.w3.org/TR/xml/#NT-Name)` production, then
[throw](https://webidl.spec.whatwg.org/#dfn-throw) an "`[InvalidCharacterError](https://webidl.spec.whatwg.org/#invalidcharactererror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
If data contains the string "`?>`", then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an
"`[InvalidCharacterError](https://webidl.spec.whatwg.org/#invalidcharactererror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
Set pi’s target to target.
Set pi’s data to data.
Update attributes from data given pi.
To update attributes from data, given a `ProcessingInstruction` node pi:
[Clear](https://infra.spec.whatwg.org/#map-clear) pi’s attribute map.
Let result be the [parsing result](https://www.w3.org/TR/xml-stylesheet/#dt-parsing-result) of invoking the
[rules for parsing pseudo-attributes from a string](https://www.w3.org/TR/xml-stylesheet/#dt-parsing) given pi’s
data.
If result is an error, then return.
For each [pseudo-attribute](https://www.w3.org/TR/xml-stylesheet/#dt-pseudo-attribute) pseudoAttr of result:
[set](https://infra.spec.whatwg.org/#map-set) pi’s
attribute map[pseudoAttr’s [name](https://www.w3.org/TR/xml-stylesheet/#dt-name)]
to pseudoAttr’s [value](https://www.w3.org/TR/xml-stylesheet/#dt-value).
To update data from attributes, given a `ProcessingInstruction` node pi:
Let data be the empty string.
[For each](https://infra.spec.whatwg.org/#map-iterate) name → value of pi’s
attribute map:
If data is not the empty string, then append U+0020 SPACE to data.
Append name to data.
Append U+003D (=) to data.
Append U+0022 (") to data.
Replace any U+0026 (&) in value with "`&`".
Replace any U+003C (<) in value with "`<`".
Replace any U+003D (>) in value with "`>`".
Replace any U+0022 (") in value with "`"`".
Append value to data.
Append U+0022 (") to data.
Replace data of pi with 0, pi’s length,
data, and true.
To get a processing instruction attribute, given a `ProcessingInstruction` node pi and a string name: return pi’s
attribute map[name] [with default](https://infra.spec.whatwg.org/#map-with-default) null.
The
`new ProcessingInstruction(target, data)`
constructor steps are:
Set [this](https://webidl.spec.whatwg.org/#this)’s node document to [current global object](https://html.spec.whatwg.org/multipage/webappapis.html#current-global-object)’s
[associated `Document`](https://html.spec.whatwg.org/multipage/nav-history-apis.html#concept-document-window).
Initialize [this](https://webidl.spec.whatwg.org/#this) with target and
data.
The `target` getter steps are to return
[this](https://webidl.spec.whatwg.org/#this)’s target.
The `hasAttributes()` method steps are to
return false if [this](https://webidl.spec.whatwg.org/#this)’s attribute map [is empty](https://infra.spec.whatwg.org/#map-is-empty); otherwise true.
The `getAttributeNames()` method steps
are to return the result of [getting the keys](https://infra.spec.whatwg.org/#map-getting-the-keys) of [this](https://webidl.spec.whatwg.org/#this)’s
attribute map.
The `getAttribute(name)` method
steps are to return the result of getting a processing instruction attribute given [this](https://webidl.spec.whatwg.org/#this)
and name.
The
`setAttribute(name, value)`
method steps are:
If name is not a valid attribute local name, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an
"`[InvalidCharacterError](https://webidl.spec.whatwg.org/#invalidcharactererror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
[Set](https://infra.spec.whatwg.org/#map-set) [this](https://webidl.spec.whatwg.org/#this)’s
attribute map[name] to value.
Update data from attributes given [this](https://webidl.spec.whatwg.org/#this).
The `removeAttribute(name)`
method steps are:
[Remove](https://infra.spec.whatwg.org/#map-remove) [this](https://webidl.spec.whatwg.org/#this)’s
attribute map[name].
Update data from attributes given [this](https://webidl.spec.whatwg.org/#this).
The
`toggleAttribute(name, force)`
method steps are:
If name is not a valid attribute local name, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an
"`[InvalidCharacterError](https://webidl.spec.whatwg.org/#invalidcharactererror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
Let attributes be [this](https://webidl.spec.whatwg.org/#this)’s attribute map.
If attributes[name] does not [exist](https://infra.spec.whatwg.org/#map-exists):
If force is not given or is true, [set](https://infra.spec.whatwg.org/#map-set) attributes[name] to the empty string, update data from attributes
given [this](https://webidl.spec.whatwg.org/#this), and then return true.
Return false.
If force is not given or is false, [remove](https://infra.spec.whatwg.org/#map-remove) attributes[name], update data from attributes given [this](https://webidl.spec.whatwg.org/#this), and
then return false.
Return true.
The `hasAttribute(name)`
method steps are to return true if [this](https://webidl.spec.whatwg.org/#this)’s
attribute map[name] [exists](https://infra.spec.whatwg.org/#list-contain); otherwise
false.
[[Exposed](https://webidl.spec.whatwg.org/#Exposed)=Window]
interface : CharacterData {
(optional [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) = "");
};
`comment = new` Returns a new `Comment` node whose
data is data.
To given a document document and
a string data:
Let comment be the result of creating a node that implements `Comment`,
given document.
Set comment’s data to data.
Return comment.
The
constructor steps are to set [this](https://webidl.spec.whatwg.org/#this)’s data to data and
[this](https://webidl.spec.whatwg.org/#this)’s node document to [current global object](https://html.spec.whatwg.org/multipage/webappapis.html#current-global-object)’s
[associated `Document`](https://html.spec.whatwg.org/multipage/nav-history-apis.html#concept-document-window).
5. Ranges 5.1. Introduction to "DOM Ranges" `StaticRange` and `Range` objects (ranges) represent a sequence of content within a
node tree. Each range has a start and an end which
are boundary points. A boundary point is a [tuple](https://infra.spec.whatwg.org/#tuple) consisting of a
node and an offset. So in other words, a
range represents a piece of content within a node tree between two
boundary points.
Ranges are frequently used in editing for selecting and copying content.
`Element`: `p` `Element`: `
` `Text`: CSS 2.1 syndata is `Element`: `` `Text`: awesome `Text`: ! In the node tree above, a
range can be used to represent the sequence
“syndata is awes”. Assuming p is assigned to the
`p` element, and
em to the `em` element, this would be done as follows:
`var range = new Range(),
firstText = p.childNodes[1],
secondText = em.firstChild
range.setStart(firstText, 9) // do not forget the leading space
range.setEnd(secondText, 4) // range now stringifies to the aforementioned quote` Attributes such as `src` and `alt` in the
node tree above cannot be represented by a range. Ranges are only useful for
nodes.
`Range` objects, unlike `StaticRange` objects, are affected by mutations to the
node tree. Therefore they are also known as live ranges. Such mutations will not
invalidate them and will try to ensure that it still represents the same piece of content.
Necessarily, a live range might itself be modified as part of the mutation to the
node tree when, e.g., part of the content it represents is mutated.
See the insert and remove algorithms, the
`normalize()` method, and the replace data and split
algorithms for details.
Updating live ranges in response to node tree mutations can be expensive. For every
node tree change, all affected `Range` objects need to be updated. Even if the application
is uninterested in some live ranges, it still has to pay the cost of keeping them up-to-date
when a mutation occurs.
A `StaticRange` object is a lightweight range that does not update when the
node tree mutates. It is therefore not subject to the same maintenance cost as
live ranges.
5.2. Boundary points A boundary point is a [tuple](https://infra.spec.whatwg.org/#tuple) consisting of a
node (a node) and an
offset (a non-negative integer).
A correct boundary point’s offset will
be between 0 and the boundary point’s node’s
length, inclusive.
The position of a
boundary point (nodeA, offsetA) relative to a boundary point
(nodeB, offsetB) is
before,
equal, or
after, as returned by these steps:
Assert: nodeA and nodeB have the same root.
If nodeA is nodeB, then return equal if
offsetA is offsetB, before if offsetA
is less than offsetB, and after if offsetA is
greater than offsetB.
If nodeA is following nodeB, then if the
position of (nodeB, offsetB) relative to
(nodeA, offsetA) is before, return
after, and if it is after, return
before.
If nodeA is an ancestor of nodeB:
Let child be nodeB.
While child is not a child of nodeA, set
child to its parent.
If child’s index is less than offsetA, then return
after.
Return before.
5.3. Interface `AbstractRange` [[Exposed](https://webidl.spec.whatwg.org/#Exposed)=Window]
interface `AbstractRange` {
readonly attribute Node startContainer;
readonly attribute [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) startOffset;
readonly attribute Node endContainer;
readonly attribute [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) endOffset;
readonly attribute [boolean](https://webidl.spec.whatwg.org/#idl-boolean) collapsed;
};
Objects implementing the `AbstractRange` interface are known as
ranges.
A range has two associated boundary points — a
start and
end.
For convenience, a range’s
start node is its start’s
node, its
start offset is its
start’s offset, its
end node is its end’s
node, and its
end offset is its end’s
offset.
A range is collapsed if its start node is its
end node and its start offset is its end offset.
`node = range . startContainer` Returns range’s start node.
`offset = range . startOffset` Returns range’s start offset.
`node = range . endContainer` Returns range’s end node.
`offset = range . endOffset` Returns range’s end offset.
`collapsed = range . collapsed` Returns true if range is collapsed; otherwise false.
The
`startContainer`
getter steps are to return [this](https://webidl.spec.whatwg.org/#this)’s start node.
The `startOffset`
getter steps are to return [this](https://webidl.spec.whatwg.org/#this)’s start offset.
The `endContainer`
getter steps are to return [this](https://webidl.spec.whatwg.org/#this)’s end node.
The `endOffset`
getter steps are to return [this](https://webidl.spec.whatwg.org/#this)’s end offset.
The `collapsed`
getter steps are to return true if [this](https://webidl.spec.whatwg.org/#this) is collapsed; otherwise false.
5.4. Interface `StaticRange` dictionary `StaticRangeInit` {
required Node `startContainer`;
required [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `startOffset`;
required Node `endContainer`;
required [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `endOffset`;
};
[[Exposed](https://webidl.spec.whatwg.org/#Exposed)=Window]
interface `StaticRange` : AbstractRange {
constructor(StaticRangeInit `init`);
};
`staticRange = new StaticRange(init)` Returns a new range object that does not update when the node tree mutates.
The
`new StaticRange(init)`
constructor steps are:
If init["`startContainer`"] or
init["`endContainer`"] is a `DocumentType` or `Attr` node, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an "`[InvalidNodeTypeError](https://webidl.spec.whatwg.org/#invalidnodetypeerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
Set [this](https://webidl.spec.whatwg.org/#this)’s start to
(init["`startContainer`"],
init["`startOffset`"]) and end to
(init["`endContainer`"],
init["`endOffset`"]).
A `StaticRange` is valid if all of the following are true:
Its start and end are in the same node tree.
Its start offset is between 0 and its start node’s
length, inclusive.
Its end offset is between 0 and its end node’s
length, inclusive.
Its start is before or
equal to its end.
5.5. Interface `Range` [[Exposed](https://webidl.spec.whatwg.org/#Exposed)=Window]
interface `Range` : AbstractRange {
constructor();
readonly attribute Node commonAncestorContainer;
[undefined](https://webidl.spec.whatwg.org/#idl-undefined) setStart(Node `node`, [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `offset`);
[undefined](https://webidl.spec.whatwg.org/#idl-undefined) setEnd(Node `node`, [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `offset`);
[undefined](https://webidl.spec.whatwg.org/#idl-undefined) setStartBefore(Node `node`);
[undefined](https://webidl.spec.whatwg.org/#idl-undefined) setStartAfter(Node `node`);
[undefined](https://webidl.spec.whatwg.org/#idl-undefined) setEndBefore(Node `node`);
[undefined](https://webidl.spec.whatwg.org/#idl-undefined) setEndAfter(Node `node`);
[undefined](https://webidl.spec.whatwg.org/#idl-undefined) collapse(optional [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `toStart` = false);
[undefined](https://webidl.spec.whatwg.org/#idl-undefined) selectNode(Node `node`);
[undefined](https://webidl.spec.whatwg.org/#idl-undefined) selectNodeContents(Node `node`);
const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `START_TO_START` = 0;
const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `START_TO_END` = 1;
const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `END_TO_END` = 2;
const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `END_TO_START` = 3;
[short](https://webidl.spec.whatwg.org/#idl-short) compareBoundaryPoints([unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `how`, Range `sourceRange`);
[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) deleteContents();
[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions), [NewObject](https://webidl.spec.whatwg.org/#NewObject)] DocumentFragment extractContents();
[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions), [NewObject](https://webidl.spec.whatwg.org/#NewObject)] DocumentFragment cloneContents();
[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) insertNode(Node `node`);
[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) surroundContents(Node `newParent`);
[[NewObject](https://webidl.spec.whatwg.org/#NewObject)] Range cloneRange();
[undefined](https://webidl.spec.whatwg.org/#idl-undefined) detach();
[boolean](https://webidl.spec.whatwg.org/#idl-boolean) isPointInRange(Node `node`, [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `offset`);
[short](https://webidl.spec.whatwg.org/#idl-short) comparePoint(Node `node`, [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `offset`);
[boolean](https://webidl.spec.whatwg.org/#idl-boolean) intersectsNode(Node `node`);
stringifier;
};
Objects implementing the `Range` interface are known as
live ranges.
Algorithms that modify a tree (in particular the insert,
remove, move, replace data, and split
algorithms) modify live ranges associated with that tree.
The root of a live range is the
root of its start node.
A node node is contained
in a live range range if node’s root is
range’s root, and (node, 0) is
after range’s start, and
(node, node’s length) is before range’s end.
A node is
partially contained in a live range
if it’s an inclusive ancestor of the live range’s start node
but not its end node, or vice versa.
Some facts to better understand these definitions:
The content that one would think of as being within the live range consists of all
contained nodes, plus possibly some of the contents of the
start node and end node if those are `CharacterData` nodes.
The nodes that are contained in a live range will generally not be
contiguous, because the parent of a contained node will not always be contained.
However, the descendants of a contained node are contained, and if two siblings are
contained, so are any siblings that lie between them.
The start node and end node of a live range are
never contained within it.
The first contained node (if there are any) will
always be after the start node, and the last contained node will always be equal to or before the end node’s last
descendant.
There exists a partially contained node if and only if
the start node and end node are different.
The `commonAncestorContainer` attribute value is neither
contained nor partially contained.
If the start node is an ancestor of the
end node, the common inclusive ancestor will be the
start node. Exactly one of its children will be
partially contained, and a child will be
contained if and only if it precedes the
partially contained child. If the
end node is an ancestor of the start node, the
opposite holds.
If the start node is not an inclusive ancestor of the
end node, nor vice versa, the common inclusive ancestor will be
distinct from both of them. Exactly two of its children will be
partially contained, and a child will be contained if and
only if it lies between those two.
The live range pre-remove steps given a node node, are:
Let parent be node’s parent.
[Assert](https://infra.spec.whatwg.org/#assert): parent is non-null.
Let index be node’s index.
For each live range whose start node is an
inclusive descendant of node, set its start to
(parent, index).
For each live range whose end node is an inclusive descendant
of node, set its end to (parent, index).
For each live range whose start node is parent and
start offset is greater than index, decrease its
start offset by 1.
For each live range whose end node is parent and
end offset is greater than index, decrease its
end offset by 1.
`range = new Range()` Returns a new live range.
The `new Range()` constructor steps are
to set [this](https://webidl.spec.whatwg.org/#this)’s start and end to
([current global object](https://html.spec.whatwg.org/multipage/webappapis.html#current-global-object)’s [associated `Document`](https://html.spec.whatwg.org/multipage/nav-history-apis.html#concept-document-window), 0).
container = range . `commonAncestorContainer` Returns the node, furthest away from the document, that is an
ancestor of both range’s start node and
end node.
To get the common ancestor of a live range range:
Let container be range’s start node.
While container is not an inclusive ancestor of
range’s end node: set container to container’s
parent.
Return container.
The `commonAncestorContainer` getter steps are to
return the result of getting the common ancestor of [this](https://webidl.spec.whatwg.org/#this).
To
set the start or end
of a range to a boundary point (node, offset):
If node is a doctype, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an
"`[InvalidNodeTypeError](https://webidl.spec.whatwg.org/#invalidnodetypeerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
If offset is greater than node’s length, then
[throw](https://webidl.spec.whatwg.org/#dfn-throw) an "`[IndexSizeError](https://webidl.spec.whatwg.org/#indexsizeerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
Let boundaryPoint be the boundary point
(node, offset).
If these steps were invoked as "set the start"
If range’s root is not node’s
root or boundaryPoint is after range’s end, then set range’s end
to boundaryPoint.
Set range’s start to boundaryPoint.
If these steps were invoked as "set the end"
If range’s root is not node’s
root or boundaryPoint is before range’s start, then set range’s start
to boundaryPoint.
Set range’s end to boundaryPoint.
The `setStart(node, offset)` method
steps are to set the start of [this](https://webidl.spec.whatwg.org/#this) to boundary point
(node, offset).
The `setEnd(node, offset)` method
steps are to set the end of [this](https://webidl.spec.whatwg.org/#this) to boundary point
(node, offset).
The `setStartBefore(node)` method steps are:
Let parent be node’s parent.
If parent is null, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an "`[InvalidNodeTypeError](https://webidl.spec.whatwg.org/#invalidnodetypeerror)`"
`[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
Set the start of [this](https://webidl.spec.whatwg.org/#this) to boundary point
(parent, node’s index).
The `setStartAfter(node)` method steps are:
Let parent be node’s parent.
If parent is null, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an "`[InvalidNodeTypeError](https://webidl.spec.whatwg.org/#invalidnodetypeerror)`"
`[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
Set the start of [this](https://webidl.spec.whatwg.org/#this) to boundary point
(parent, node’s index plus 1).
The `setEndBefore(node)` method steps are:
Let parent be node’s parent.
If parent is null, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an "`[InvalidNodeTypeError](https://webidl.spec.whatwg.org/#invalidnodetypeerror)`"
`[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
Set the end of [this](https://webidl.spec.whatwg.org/#this) to boundary point
(parent, node’s index).
The `setEndAfter(node)` method steps are:
Let parent be node’s parent.
If parent is null, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an "`[InvalidNodeTypeError](https://webidl.spec.whatwg.org/#invalidnodetypeerror)`"
`[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
Set the end of [this](https://webidl.spec.whatwg.org/#this) to boundary point
(parent, node’s index plus 1).
The `collapse(toStart)` method steps are to, if
toStart is true, set end to start; otherwise set
start to end.
To select a node node
within a range range:
Let parent be node’s parent.
If parent is null, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an "`[InvalidNodeTypeError](https://webidl.spec.whatwg.org/#invalidnodetypeerror)`"
`[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
Let index be node’s index.
Set range’s start to boundary point
(parent, index).
Set range’s end to boundary point
(parent, index plus 1).
The `selectNode(node)` method steps are to
select node within [this](https://webidl.spec.whatwg.org/#this).
The `selectNodeContents(node)` method steps
are:
If node is a doctype, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an
"`[InvalidNodeTypeError](https://webidl.spec.whatwg.org/#invalidnodetypeerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
Let length be the length of node.
Set start to the boundary point (node, 0).
Set end to the boundary point (node, length).
The
`compareBoundaryPoints(how, sourceRange)`
method steps are:
If how is not one of
`START_TO_START`,
`START_TO_END`,
`END_TO_END`, and
`END_TO_START`,
then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[NotSupportedError](https://webidl.spec.whatwg.org/#notsupportederror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
If [this](https://webidl.spec.whatwg.org/#this)’s root is not sourceRange’s
root, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[WrongDocumentError](https://webidl.spec.whatwg.org/#wrongdocumenterror)`"
`[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
Let thisPoint and sourcePoint be null.
Switch on how:
`START_TO_START`:
Set thisPoint to [this](https://webidl.spec.whatwg.org/#this)’s start and
sourcePoint to sourceRange’s start.
`START_TO_END`:
Set thisPoint to [this](https://webidl.spec.whatwg.org/#this)’s end and sourcePoint
to sourceRange’s start.
`END_TO_END`:
Set thisPoint to [this](https://webidl.spec.whatwg.org/#this)’s end and sourcePoint
to sourceRange’s end.
`END_TO_START`:
Set thisPoint to [this](https://webidl.spec.whatwg.org/#this)’s start and
sourcePoint to sourceRange’s end.
Switch on the position of thisPoint relative to
sourcePoint:
before Return −1.
equal Return 0.
after Return 1.
The `deleteContents()` method steps are:
If [this](https://webidl.spec.whatwg.org/#this) is collapsed, then return.
Let originalStartNode, originalStartOffset,
originalEndNode, and originalEndOffset be [this](https://webidl.spec.whatwg.org/#this)’s
start node, start offset, end node, and
end offset, respectively.
If originalStartNode is originalEndNode and it is a `CharacterData` node:
Replace data of originalStartNode with originalStartOffset,
originalEndOffset − originalStartOffset, and the empty string.
Return.
Let nodesToRemove be a list of all the nodes that are
contained in [this](https://webidl.spec.whatwg.org/#this), in tree order, omitting any
node whose parent is also contained in
[this](https://webidl.spec.whatwg.org/#this).
Let newNode and newOffset be null.
If originalStartNode is an inclusive ancestor of
originalEndNode, then set newNode to originalStartNode and
newOffset to originalStartOffset.
Otherwise:
Let referenceNode be originalStartNode.
While referenceNode’s parent is non-null and is not an
inclusive ancestor of originalEndNode: set referenceNode to
its parent.
Set newNode to referenceNode’s parent and
newOffset to referenceNode’s index + 1.
If referenceNode’s parent were null, it would be the
root of [this](https://webidl.spec.whatwg.org/#this). And then it would be an
inclusive ancestor of originalEndNode and we could not reach this
point.
Set [this](https://webidl.spec.whatwg.org/#this)’s start and end to
(newNode, newOffset).
If originalStartNode is a `CharacterData` node, then
replace data of originalStartNode with originalStartOffset,
originalStartNode’s length − originalStartOffset, and
the empty string.
For each node of nodesToRemove, in tree order:
remove node.
If originalEndNode is a `CharacterData` node, then
replace data of originalEndNode with 0, originalEndOffset, and
the empty string.
To extract a live range range:
Let fragment be the result of creating a document fragment given
range’s start node’s node document.
If range is collapsed, then return fragment.
Let originalStartNode, originalStartOffset,
originalEndNode, and originalEndOffset be range’s
start node, start offset, end node, and
end offset, respectively.
If originalStartNode is originalEndNode and it is a `CharacterData` node:
Let clone be a clone of originalStartNode.
Set clone’s data to the result of
substringing data of originalStartNode with originalStartOffset and
originalEndOffset − originalStartOffset.
Append clone to fragment.
Replace data of originalStartNode with originalStartOffset,
originalEndOffset − originalStartOffset, and the empty string.
Return fragment.
Let commonAncestor be the result of getting the common ancestor of
range.
Let firstPartiallyContainedChild be null.
If originalStartNode is not an inclusive ancestor of
originalEndNode, then set firstPartiallyContainedChild to the first
child of commonAncestor that is
partially contained in range.
Let lastPartiallyContainedChild be null.
If originalEndNode is not an inclusive ancestor of
originalStartNode, then set lastPartiallyContainedChild to the last
child of commonAncestor that is
partially contained in range.
These variable assignments do actually always make sense. For instance, if
originalStartNode is not an inclusive ancestor of
originalEndNode, originalStartNode is itself
partially contained in range, and so are all its
ancestors up until a child of commonAncestor.
commonAncestor cannot be originalStartNode, because it has to be an
inclusive ancestor of originalEndNode. The other case is similar. Also,
notice that the two children will never be equal if both are defined.
Let containedChildren be a list of all children of
commonAncestor that are contained in range, in
tree order.
If any member of containedChildren is a doctype, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a
"`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
We do not have to worry about the first or last partially
contained node, because a doctype can never be
partially contained. It cannot be a boundary point of a range, and it
cannot be the ancestor of anything.
Let newNode and newOffset be null.
If originalStartNode is an inclusive ancestor of
originalEndNode, then set newNode to originalStartNode and
newOffset to originalStartOffset.
Otherwise:
Let referenceNode be originalStartNode.
While referenceNode’s parent is non-null and is not an
inclusive ancestor of originalEndNode: set referenceNode to
its parent.
Set newNode to the parent of referenceNode, and
newOffset to referenceNode’s index + 1.
If referenceNode’s parent is null, it would be the
root of range. And then it would be an
inclusive ancestor of originalEndNode and we could not reach this
point.
Set range’s start and end to
(newNode, newOffset).
If firstPartiallyContainedChild is a `CharacterData` node:
In this case, firstPartiallyContainedChild is
originalStartNode.
Let clone be a clone of
originalStartNode.
Set the data of clone to the result of
substringing data of originalStartNode with originalStartOffset and
originalStartNode’s length − originalStartOffset.
Append clone to fragment.
Replace data of originalStartNode with originalStartOffset,
originalStartNode’s length − originalStartOffset, and
the empty string.
Otherwise, if firstPartiallyContainedChild is non-null:
Let clone be a clone of
firstPartiallyContainedChild.
Append clone to fragment.
Let subrange be a new live range whose start is
(originalStartNode, originalStartOffset) and whose end is
(firstPartiallyContainedChild, firstPartiallyContainedChild’s
length).
Let subfragment be the result of extracting subrange.
Append subfragment to clone.
For each contained child of containedChildren: append contained child to fragment.
If lastPartiallyContainedChild is a `CharacterData` node:
In this case, lastPartiallyContainedChild is
originalEndNode.
Let clone be a clone of originalEndNode.
Set clone’s data to the result of
substringing data of originalEndNode with 0 and originalEndOffset.
Append clone to fragment.
Replace data of originalEndNode with 0, originalEndOffset,
and the empty string.
Otherwise, if lastPartiallyContainedChild is non-null:
Let clone be a clone of
lastPartiallyContainedChild.
Append clone to fragment.
Let subrange be a new live range whose start is
(lastPartiallyContainedChild, 0) and whose end is
(originalEndNode, originalEndOffset).
Let subfragment be the result of extracting subrange.
Append subfragment to clone.
Return fragment.
The `extractContents()` method steps are to return the
result of extracting [this](https://webidl.spec.whatwg.org/#this).
To
clone the contents
of a live range range:
Let fragment be the result of creating a document fragment given
range’s start node’s node document.
If range is collapsed, then return fragment.
Let originalStartNode, originalStartOffset,
originalEndNode, and originalEndOffset be range’s
start node, start offset, end node, and
end offset, respectively.
If originalStartNode is originalEndNode and it is a `CharacterData` node:
Let clone be a clone of originalStartNode.
Set clone’s data to the result of
substringing data of originalStartNode with originalStartOffset and
originalEndOffset − originalStartOffset.
Append clone to fragment.
Return fragment.
Let commonAncestor be the result of getting the common ancestor of
range.
Let firstPartiallyContainedChild be null.
If originalStartNode is not an inclusive ancestor of
originalEndNode, then set firstPartiallyContainedChild to the first
child of commonAncestor that is
partially contained in range.
Let lastPartiallyContainedChild be null.
If originalEndNode is not an inclusive ancestor of
originalStartNode, then set lastPartiallyContainedChild to the last
child of commonAncestor that is
partially contained in range.
These variable assignments do actually always make sense. For instance, if
originalStartNode is not an inclusive ancestor of
originalEndNode, originalStartNode is itself
partially contained in range, and so are all its
ancestors up until a child of commonAncestor.
commonAncestor cannot be originalStartNode, because it has to be an
inclusive ancestor of originalEndNode. The other case is similar. Also,
notice that the two children will never be equal if both are defined.
Let containedChildren be a list of all children of
commonAncestor that are contained in range, in
tree order.
If any member of containedChildren is a doctype, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a
"`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
We do not have to worry about the first or last partially
contained node, because a doctype can never be
partially contained. It cannot be a boundary point of a range, and it
cannot be the ancestor of anything.
If firstPartiallyContainedChild is a `CharacterData` node:
In this case, firstPartiallyContainedChild is
originalStartNode.
Let clone be a clone of originalStartNode.
Set the data of clone to the result of
substringing data of originalStartNode with originalStartOffset and
originalStartNode’s length − originalStartOffset.
Append clone to fragment.
Otherwise, if firstPartiallyContainedChild is non-null:
Let clone be a clone of
firstPartiallyContainedChild.
Append clone to fragment.
Let subrange be a new live range whose start is
(originalStartNode, originalStartOffset) and whose end is
(firstPartiallyContainedChild, firstPartiallyContainedChild’s
length).
Let subfragment be the result of cloning the contents
of subrange.
Append subfragment to clone.
For each contained child of containedChildren:
Let clone be a clone of contained child
with *subtree* set to true.
Append clone to fragment.
If lastPartiallyContainedChild is a `CharacterData` node:
In this case, lastPartiallyContainedChild is
originalEndNode.
Let clone be a clone of originalEndNode.
Set clone’s data to the result of
substringing data of originalEndNode with 0 and originalEndOffset.
Append clone to fragment.
Otherwise, if lastPartiallyContainedChild is non-null:
Let clone be a clone of
lastPartiallyContainedChild.
Append clone to fragment.
Let subrange be a new live range whose start is
(lastPartiallyContainedChild, 0) and whose end is
(originalEndNode, originalEndOffset).
Let subfragment be the result of cloning the contents
of subrange.
Append subfragment to clone.
Return fragment.
The `cloneContents()` method steps are to return the
result of cloning the contents of [this](https://webidl.spec.whatwg.org/#this).
To insert a node node into a live range range:
If range’s start node is a `ProcessingInstruction` or
`Comment` node, is a `Text` node whose parent is
null, or is node, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[HierarchyRequestError](https://webidl.spec.whatwg.org/#hierarchyrequesterror)`"
`[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
Let referenceNode be null.
If range’s start node is a `Text` node, then set
referenceNode to that `Text` node.
Otherwise, set referenceNode to the child of range’s
start node whose index is range’s
start offset if there is such a child; otherwise null.
Let parent be range’s start node if
referenceNode is null; otherwise referenceNode’s parent.
Ensure pre-insert validity given node, parent,
referenceNode, and « ».
If range’s start node is a `Text` node, then set
referenceNode to the result of splitting it with offset
range’s start offset.
If node is referenceNode, then set referenceNode to its
next sibling.
If node’s parent is non-null, then remove node.
Let newOffset be parent’s length if
referenceNode is null; otherwise referenceNode’s index.
Increase newOffset by node’s length if node
is a `DocumentFragment` node; otherwise 1.
Pre-insert node into parent before referenceNode.
If range is collapsed, then set range’s
end to (parent, newOffset).
The `insertNode(node)` method steps are to
insert node into [this](https://webidl.spec.whatwg.org/#this).
The `surroundContents(newParent)` method steps
are:
If a non-`Text` node is partially contained in
[this](https://webidl.spec.whatwg.org/#this), then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an "`[InvalidStateError](https://webidl.spec.whatwg.org/#invalidstateerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
If newParent is a `Document`, `DocumentType`, or `DocumentFragment` node, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an "`[InvalidNodeTypeError](https://webidl.spec.whatwg.org/#invalidnodetypeerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
For historical reasons `CharacterData` nodes are not checked here and end up throwing later on as a side effect.
Let fragment be the result of extracting [this](https://webidl.spec.whatwg.org/#this).
If newParent has children, then replace all with
null within newParent.
Insert newParent into [this](https://webidl.spec.whatwg.org/#this).
Append fragment to newParent.
Select newParent within [this](https://webidl.spec.whatwg.org/#this).
The `cloneRange()` method steps are to return a new
live range with the same start and end as [this](https://webidl.spec.whatwg.org/#this).
The `detach()` method steps are to do nothing.
Its functionality (disabling a `Range` object) was removed, but the method itself
is preserved for compatibility.
position = range . `comparePoint(node, offset)` Returns −1 if the point is before the range, 0 if the point is
in the range, and 1 if the point is after the range.
intersects = range . `intersectsNode(node)` Returns whether range intersects
node.
The `isPointInRange(node, offset)`
method steps are:
If node’s root is not [this](https://webidl.spec.whatwg.org/#this)’s root,
then return false.
If node is a doctype, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an
"`[InvalidNodeTypeError](https://webidl.spec.whatwg.org/#invalidnodetypeerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
If offset is greater than node’s length, then
[throw](https://webidl.spec.whatwg.org/#dfn-throw) an "`[IndexSizeError](https://webidl.spec.whatwg.org/#indexsizeerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
If (node, offset) is before start or after end, then return
false.
Return true.
The `comparePoint(node, offset)`
method steps are:
If node’s root is not [this](https://webidl.spec.whatwg.org/#this)’s root,
then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[WrongDocumentError](https://webidl.spec.whatwg.org/#wrongdocumenterror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
If node is a doctype, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an
"`[InvalidNodeTypeError](https://webidl.spec.whatwg.org/#invalidnodetypeerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
If offset is greater than node’s length, then
[throw](https://webidl.spec.whatwg.org/#dfn-throw) an "`[IndexSizeError](https://webidl.spec.whatwg.org/#indexsizeerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
If (node, offset) is before start, then return −1.
If (node, offset) is after end, then return 1.
Return 0.
The `intersectsNode(node)` method steps are:
If node’s root is not [this](https://webidl.spec.whatwg.org/#this)’s root,
then return false.
Let parent be node’s
parent.
If parent is null, then return true.
Let offset be node’s index.
If (parent, offset) is before end and (parent, offset + 1) is
after start, then return true.
Return false.
The stringification behavior must run
these steps:
Let string be the empty string.
If [this](https://webidl.spec.whatwg.org/#this)’s start node is [this](https://webidl.spec.whatwg.org/#this)’s end node and
it is a `Text` node, then return the substring of that `Text` node’s
data beginning at [this](https://webidl.spec.whatwg.org/#this)’s start offset and ending
at [this](https://webidl.spec.whatwg.org/#this)’s end offset.
If [this](https://webidl.spec.whatwg.org/#this)’s start node is a `Text` node, then append
the substring of that node’s data from [this](https://webidl.spec.whatwg.org/#this)’s
start offset until the end to string.
Append the [concatenation](https://infra.spec.whatwg.org/#string-concatenate) of the data of all
`Text` nodes that are contained in [this](https://webidl.spec.whatwg.org/#this), in
tree order, to string.
If [this](https://webidl.spec.whatwg.org/#this)’s end node is a `Text` node, then
append the substring of that node’s data from its start until
[this](https://webidl.spec.whatwg.org/#this)’s end offset to string.
Return string.
The `[createContextualFragment()](https://w3c.github.io/DOM-Parsing/#dom-range-createcontextualfragment)`, `[getClientRects()](https://drafts.csswg.org/cssom-view-1/#dom-range-getclientrects)`,
and `[getBoundingClientRect()](https://drafts.csswg.org/cssom-view-1/#dom-range-getboundingclientrect)` methods are defined in other specifications.
[DOM-Parsing] [CSSOM-VIEW] 6. Traversal `NodeIterator` and `TreeWalker` objects can be used to filter and traverse node trees.
Each `NodeIterator` and `TreeWalker` object has an associated boolean
is active to avoid recursive invocations. It is
initially false.
Each `NodeIterator` and `TreeWalker` object also has an associated
root (a node), a
whatToShow (a bitmask), and a
filter (a callback).
To filter a node node within
a `NodeIterator` or `TreeWalker` object traverser:
If traverser’s is active is true, then throw an
"`[InvalidStateError](https://webidl.spec.whatwg.org/#invalidstateerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
Let n be node’s `nodeType` attribute value − 1.
If the nth bit (where 0 is the least significant bit) of
traverser’s whatToShow is not set, then return
`FILTER_SKIP`.
If traverser’s filter is null, then return
`FILTER_ACCEPT`.
Set traverser’s is active to true.
Let result be the return value of [call a user object’s operation](https://webidl.spec.whatwg.org/#call-a-user-objects-operation) with
traverser’s filter, "`acceptNode`", and
« node ». If this throws an exception, then set traverser’s
is active to false and rethrow the exception.
Set traverser’s is active to false.
Return result.
6.1. Interface `NodeIterator` [[Exposed](https://webidl.spec.whatwg.org/#Exposed)=Window]
interface `NodeIterator` {
[[SameObject](https://webidl.spec.whatwg.org/#SameObject)] readonly attribute Node root;
readonly attribute Node referenceNode;
readonly attribute [boolean](https://webidl.spec.whatwg.org/#idl-boolean) pointerBeforeReferenceNode;
readonly attribute [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) whatToShow;
readonly attribute NodeFilter? filter;
Node? nextNode();
Node? previousNode();
[undefined](https://webidl.spec.whatwg.org/#idl-undefined) detach();
};
`NodeIterator` objects can be created using the
`createNodeIterator()` method on `Document` objects.
Each `NodeIterator` object has an associated
iterator collection, which is a
collection rooted at the `NodeIterator` object’s root, whose
filter matches any node.
A node pointer is a [tuple](https://infra.spec.whatwg.org/#tuple) consisting of a
node (a node) and a
pointer before (a boolean).
Each `NodeIterator` object also has an associated reference (a
node pointer) and candidate reference (null or a
node pointer, and initially null).
As mentioned earlier, `NodeIterator` objects have an associated
is active, root, whatToShow, and
filter as well.
The `NodeIterator` pre-remove steps
given a `NodeIterator` object nodeIterator and node toBeRemovedNode, are:
Set nodeIterator’s reference to the result of
adjusting a node pointer given nodeIterator’s
reference, nodeIterator, and toBeRemovedNode.
If nodeIterator’s candidate reference is non-null, then set
nodeIterator’s candidate reference to the result of
adjusting a node pointer given nodeIterator’s
candidate reference, nodeIterator, and toBeRemovedNode.
To adjust a node pointer given a node pointer nodePointer, a `NodeIterator` object nodeIterator, and a node toBeRemovedNode, perform the following steps. They return a node pointer.
If toBeRemovedNode is not an inclusive ancestor of
nodePointer’s node, or toBeRemovedNode is an
inclusive ancestor of nodeIterator’s root, then
return nodePointer.
If nodePointer’s pointer before is true:
Let next be toBeRemovedNode’s first following node that is an inclusive descendant of nodeIterator’s
root and is not an inclusive descendant of
toBeRemovedNode, if there is such a node; otherwise null.
If next is non-null, then return (next, true).
Let newNode be toBeRemovedNode’s parent, if
toBeRemovedNode’s previous sibling is null; otherwise the
inclusive descendant of toBeRemovedNode’s previous sibling that appears
last in tree order.
Return (newNode, false).
The `root` getter steps are to return
[this](https://webidl.spec.whatwg.org/#this)’s root.
The `referenceNode` getter steps are to return
[this](https://webidl.spec.whatwg.org/#this)’s reference’s node.
The `pointerBeforeReferenceNode` getter steps
are to return [this](https://webidl.spec.whatwg.org/#this)’s reference’s
pointer before.
The `whatToShow` getter steps are to return
[this](https://webidl.spec.whatwg.org/#this)’s whatToShow.
The `filter` getter steps are to return
[this](https://webidl.spec.whatwg.org/#this)’s filter.
To traverse, given a
`NodeIterator` object iterator and "`next`" or "`previous`"
type:
Set iterator’s candidate reference to iterator’s
reference.
Let result be null.
While true:
If type is "`next`":
If iterator’s candidate reference’s
pointer before is false:
Let following be the first node following iterator’s candidate reference’s node in
iterator’s iterator collection. If there is no such
node, then [break](https://infra.spec.whatwg.org/#iteration-break).
Set iterator’s candidate reference to
(following, false).
Otherwise, set iterator’s candidate reference to
(iterator’s candidate reference’s node,
false).
Otherwise:
If iterator’s candidate reference’s
pointer before is true:
Let preceding be the first node preceding iterator’s candidate reference’s node in
iterator’s iterator collection. If there is no such
node, then [break](https://infra.spec.whatwg.org/#iteration-break).
Set iterator’s candidate reference to
(preceding, true).
Otherwise, set iterator’s candidate reference to
(iterator’s candidate reference’s node,
true).
Let node be iterator’s candidate reference’s
node.
Let filterResult be the result of filtering node within
iterator. If this throws an exception, then set iterator’s
candidate reference to null and rethrow that exception.
If filterResult is `FILTER_ACCEPT`:
Set iterator’s reference to iterator’s
candidate reference.
Set result to node.
[Break](https://infra.spec.whatwg.org/#iteration-break).
Set iterator’s candidate reference to null.
Return result.
The `nextNode()` method steps are to return the
result of traversing with [this](https://webidl.spec.whatwg.org/#this) and "`next`".
The `previousNode()` method steps are to return the
result of traversing with [this](https://webidl.spec.whatwg.org/#this) and "`previous`".
The `detach()` method steps are to do nothing.
Its functionality (disabling a `NodeIterator` object) was removed, but the method
itself is preserved for compatibility. 6.2. Interface `TreeWalker` [[Exposed](https://webidl.spec.whatwg.org/#Exposed)=Window]
interface `TreeWalker` {
[[SameObject](https://webidl.spec.whatwg.org/#SameObject)] readonly attribute Node root;
readonly attribute [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) whatToShow;
readonly attribute NodeFilter? filter;
attribute Node currentNode;
Node? parentNode();
Node? firstChild();
Node? lastChild();
Node? previousSibling();
Node? nextSibling();
Node? previousNode();
Node? nextNode();
}; `TreeWalker` objects can be created using the `createTreeWalker()`
method on `Document` objects.
Each `TreeWalker` object has an associated current (a
node).
As mentioned earlier `TreeWalker` objects have an associated
root, whatToShow, and filter as well.
The `root` getter steps are to return
[this](https://webidl.spec.whatwg.org/#this)’s root.
The `whatToShow` getter steps are to return
[this](https://webidl.spec.whatwg.org/#this)’s whatToShow.
The `filter` getter steps are to return
[this](https://webidl.spec.whatwg.org/#this)’s filter.
The `currentNode` getter steps are to return
[this](https://webidl.spec.whatwg.org/#this)’s current.
The `currentNode` setter steps are to set [this](https://webidl.spec.whatwg.org/#this)’s
current to the given value.
The `parentNode()` method steps are:
Let node be [this](https://webidl.spec.whatwg.org/#this)’s current.
While node is non-null and is not [this](https://webidl.spec.whatwg.org/#this)’s
root:
Set node to node’s parent.
If node is non-null and filtering node within
[this](https://webidl.spec.whatwg.org/#this) returns `FILTER_ACCEPT`, then set [this](https://webidl.spec.whatwg.org/#this)’s
current to node and return node.
Return null.
To traverse children, given a
`TreeWalker` object walker and "`first`" or "`last`"
type:
Let node be walker’s current.
Set node to node’s first child if type is
"`first`"; otherwise to node’s last child.
While node is non-null:
Let result be the result of filtering node within
walker.
If result is `FILTER_ACCEPT`, then set walker’s
current to node and return node.
If result is `FILTER_SKIP`:
Let child be node’s first child if type
is "`first`"; otherwise node’s last child.
If child is non-null, then set node to child and
[continue](https://infra.spec.whatwg.org/#iteration-continue).
While node is non-null:
Let sibling be node’s next sibling if
type is "`first`"; otherwise node’s
previous sibling.
If sibling is non-null, then set node to sibling and
[break](https://infra.spec.whatwg.org/#iteration-break).
Let parent be node’s parent.
If parent is null, walker’s root, or
walker’s current, then return null.
Set node to parent.
Return null.
The `firstChild()` method steps are to
traverse children with [this](https://webidl.spec.whatwg.org/#this) and "`first`".
The `lastChild()` method steps are to
traverse children with [this](https://webidl.spec.whatwg.org/#this) and "`last`".
To traverse siblings, given a `TreeWalker`
object walker and "`next`" or "`previous`" type:
Let node be walker’s current.
If node is root, then return null.
While true:
Let sibling be node’s next sibling if
type is "`next`"; otherwise node’s
previous sibling.
While sibling is non-null:
Set node to sibling.
Let result be the result of filtering node within
walker.
If result is `FILTER_ACCEPT`, then set walker’s
current to node and return node.
Set sibling to node’s first child if
type is "`next`"; otherwise to node’s
last child.
If result is `FILTER_REJECT` or sibling is null, then
set sibling to node’s next sibling if type is
"`next`"; otherwise to node’s previous sibling.
Set node to node’s parent.
If node is null or walker’s root, then return
null.
If the return value of filtering node within walker is
`FILTER_ACCEPT`, then return null.
The `nextSibling()` method steps are to
traverse siblings with [this](https://webidl.spec.whatwg.org/#this) and "`next`".
The `previousSibling()` method steps are to
traverse siblings with [this](https://webidl.spec.whatwg.org/#this) and "`previous`".
The `previousNode()` method steps are:
Let node be [this](https://webidl.spec.whatwg.org/#this)’s current.
While node is not [this](https://webidl.spec.whatwg.org/#this)’s root:
Let sibling be node’s previous sibling.
While sibling is non-null:
Set node to sibling.
Let result be the result of filtering node within
[this](https://webidl.spec.whatwg.org/#this).
While result is not `FILTER_REJECT` and node has a
child:
Set node to node’s last child.
Set result to the result of filtering node within
[this](https://webidl.spec.whatwg.org/#this).
If result is `FILTER_ACCEPT`, then set [this](https://webidl.spec.whatwg.org/#this)’s
current to node and return node.
Set sibling to node’s previous sibling.
If node is [this](https://webidl.spec.whatwg.org/#this)’s root or node’s
parent is null, then return null.
Set node to node’s parent.
If the return value of filtering node within [this](https://webidl.spec.whatwg.org/#this) is
`FILTER_ACCEPT`, then set [this](https://webidl.spec.whatwg.org/#this)’s current to
node and return node.
Return null.
The `nextNode()` method steps are:
Let node be [this](https://webidl.spec.whatwg.org/#this)’s current.
Let result be `FILTER_ACCEPT`.
While true:
While result is not `FILTER_REJECT` and node has a
child:
Set node to its first child.
Set result to the result of filtering node within
[this](https://webidl.spec.whatwg.org/#this).
If result is `FILTER_ACCEPT`, then set [this](https://webidl.spec.whatwg.org/#this)’s
current to node and return node.
Let sibling be null.
Let temporary be node.
While temporary is non-null:
If temporary is [this](https://webidl.spec.whatwg.org/#this)’s root, then return null.
Set sibling to temporary’s next sibling.
If sibling is non-null, then [break](https://infra.spec.whatwg.org/#iteration-break).
Set temporary to temporary’s parent.
If sibling is null, then return null.
Set node to sibling.
Set result to the result of filtering node within
[this](https://webidl.spec.whatwg.org/#this).
If result is `FILTER_ACCEPT`, then set [this](https://webidl.spec.whatwg.org/#this)’s
current to node and return node.
6.3. Interface `NodeFilter` [[Exposed](https://webidl.spec.whatwg.org/#Exposed)=Window]
callback interface `NodeFilter` {
// Constants for acceptNode()
const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) FILTER_ACCEPT = 1;
const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) FILTER_REJECT = 2;
const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) FILTER_SKIP = 3;
// Constants for whatToShow
const [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) SHOW_ALL = 0xFFFFFFFF;
const [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) SHOW_ELEMENT = 0x1;
const [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) SHOW_ATTRIBUTE = 0x2;
const [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) SHOW_TEXT = 0x4;
const [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) SHOW_CDATA_SECTION = 0x8;
const [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `SHOW_ENTITY_REFERENCE` = 0x10; // legacy
const [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `SHOW_ENTITY` = 0x20; // legacy
const [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) SHOW_PROCESSING_INSTRUCTION = 0x40;
const [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) = 0x80;
const [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) SHOW_DOCUMENT = 0x100;
const [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) SHOW_DOCUMENT_TYPE = 0x200;
const [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) SHOW_DOCUMENT_FRAGMENT = 0x400;
const [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `SHOW_NOTATION` = 0x800; // legacy
[unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `acceptNode`(Node `node`);
};
`NodeFilter` objects can be used as filter for
`NodeIterator` and `TreeWalker` objects and also provide constants for their
whatToShow bitmask. A `NodeFilter` object is typically implemented as a
JavaScript function.
These constants can be used as filter return value:
`FILTER_ACCEPT` (1);
`FILTER_REJECT` (2);
`FILTER_SKIP` (3).
These constants can be used for whatToShow:
`SHOW_ALL` (4294967295, FFFFFFFF in hexadecimal);
`SHOW_ELEMENT` (1);
`SHOW_ATTRIBUTE` (2);
`SHOW_TEXT` (4);
`SHOW_CDATA_SECTION` (8);
`SHOW_PROCESSING_INSTRUCTION` (64, 40 in hexadecimal);
(128, 80 in hexadecimal);
`SHOW_DOCUMENT` (256, 100 in hexadecimal);
`SHOW_DOCUMENT_TYPE` (512, 200 in hexadecimal);
`SHOW_DOCUMENT_FRAGMENT` (1024, 400 in hexadecimal).
7. Sets Yes, the name `DOMTokenList` is an unfortunate legacy mishap.
7.1. Interface `DOMTokenList` [[Exposed](https://webidl.spec.whatwg.org/#Exposed)=Window]
interface `DOMTokenList` {
readonly attribute [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) length;
getter [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? item([unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `index`);
[boolean](https://webidl.spec.whatwg.org/#idl-boolean) contains([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `token`);
[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) add([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)... `tokens`);
[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)] [undefined](https://webidl.spec.whatwg.org/#idl-undefined) remove([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)... `tokens`);
[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)] [boolean](https://webidl.spec.whatwg.org/#idl-boolean) toggle([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `token`, optional [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `force`);
[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)] [boolean](https://webidl.spec.whatwg.org/#idl-boolean) replace([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `token`, [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `newToken`);
[boolean](https://webidl.spec.whatwg.org/#idl-boolean) supports([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `token`);
[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)] stringifier attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) value;
[iterable](https://webidl.spec.whatwg.org/#dfn-iterable)<[DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)>;
};
A `DOMTokenList` object has an associated
token set (a [set](https://infra.spec.whatwg.org/#ordered-set)), which is
initially empty.
A `DOMTokenList` object also has an associated element
(an element) and an attribute name (an attribute’s
local name).
Specifications may define
supported tokens for a `DOMTokenList`’s
element and attribute name. A `DOMTokenList` object set’s
validation steps for a given
token are:
If set’s element and
attribute name does not define supported tokens, then
[throw](https://webidl.spec.whatwg.org/#dfn-throw) a `TypeError`.
Let lowercaseToken be token, in [ASCII lowercase](https://infra.spec.whatwg.org/#ascii-lowercase).
If lowercaseToken is present in the supported tokens of
set’s element and attribute name, then
return true.
Return false.
A `DOMTokenList` object set’s
update steps are:
If get an attribute by namespace and local name given null, set’s
attribute name, and set’s element
returns null and set’s token set is empty, then return.
Set an attribute value given set’s element,
set’s attribute name, and the result of running the
ordered set serializer for set’s token set.
A `DOMTokenList` object set’s
serialize steps are to return the result of
running get an attribute value given set’s element and
set’s attribute name.
A `DOMTokenList` object set has these attribute change steps for
set’s element:
If localName is set’s attribute name,
namespace is null, and value is null, then [empty](https://infra.spec.whatwg.org/#list-empty) token set.
Otherwise, if localName is set’s
attribute name and namespace is null, then set set’s
token set to value, parsed.
When a `DOMTokenList` object set is created:
Let element be set’s element.
Let attributeName be set’s attribute name.
Let value be the result of
getting an attribute value given element and
attributeName.
Run the attribute change steps for element, attributeName,
value, value, and null.
`tokenlist . `length`` Returns the number of tokens.
`tokenlist . `item(index)``
`tokenlist[index]` Returns the token with index index.
`tokenlist . `contains(token)`` Returns true if token is present; otherwise false.
`tokenlist . add(tokens…)` Adds all arguments passed, except those already present.
Throws a "`[SyntaxError](https://webidl.spec.whatwg.org/#syntaxerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)` if one of the arguments is the empty
string.
Throws an "`[InvalidCharacterError](https://webidl.spec.whatwg.org/#invalidcharactererror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)` if one of the arguments
contains any [ASCII whitespace](https://infra.spec.whatwg.org/#ascii-whitespace).
`tokenlist . remove(tokens…)` Removes arguments passed, if they are present.
Throws a "`[SyntaxError](https://webidl.spec.whatwg.org/#syntaxerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)` if one of the arguments is the empty
string.
Throws an "`[InvalidCharacterError](https://webidl.spec.whatwg.org/#invalidcharactererror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)` if one of the arguments
contains any [ASCII whitespace](https://infra.spec.whatwg.org/#ascii-whitespace).
`tokenlist . toggle(token [, force])` If force is not given, "toggles" token, removing it if it’s present and
adding it if it’s not present. If force is true, adds token
(same as `add()`). If force is false, removes token (same
as `remove()`).
Returns true if token is now present; otherwise false.
Throws a "`[SyntaxError](https://webidl.spec.whatwg.org/#syntaxerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)` if token is empty.
Throws an "`[InvalidCharacterError](https://webidl.spec.whatwg.org/#invalidcharactererror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)` if token contains
any spaces.
`tokenlist . replace(token, newToken)` Replaces token with newToken.
Returns true if token was replaced with newToken; otherwise false.
Throws a "`[SyntaxError](https://webidl.spec.whatwg.org/#syntaxerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)` if one of the arguments is the empty
string.
Throws an "`[InvalidCharacterError](https://webidl.spec.whatwg.org/#invalidcharactererror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)` if one of the arguments
contains any [ASCII whitespace](https://infra.spec.whatwg.org/#ascii-whitespace).
`tokenlist . supports(token)` Returns true if token is in the associated attribute’s supported tokens. Returns
false otherwise.
Throws a `TypeError` if the associated attribute has no supported tokens defined.
`tokenlist . `value`` Returns the associated set as string.
Can be set, to change the associated attribute.
The `length` getter steps are to return
[this](https://webidl.spec.whatwg.org/#this)’s token set’s [size](https://infra.spec.whatwg.org/#list-size).
The object’s [supported property indices](https://webidl.spec.whatwg.org/#dfn-supported-property-indices) are the numbers in the range zero to object’s
token set’s [size](https://infra.spec.whatwg.org/#list-size) − 1, unless token set [is empty](https://infra.spec.whatwg.org/#list-is-empty),
in which case there are no [supported property indices](https://webidl.spec.whatwg.org/#dfn-supported-property-indices).
The `item(index)` method steps are:
If index is equal to or greater than [this](https://webidl.spec.whatwg.org/#this)’s token set’s
[size](https://infra.spec.whatwg.org/#list-size), then return null.
Return [this](https://webidl.spec.whatwg.org/#this)’s token set[index].
The `contains(token)` method steps are
to return true if [this](https://webidl.spec.whatwg.org/#this)’s token set[token] [exists](https://infra.spec.whatwg.org/#list-contain); otherwise
false.
The
`add(tokens…)`
method steps are:
[For each](https://infra.spec.whatwg.org/#list-iterate) token of tokens:
If token is the empty string, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[SyntaxError](https://webidl.spec.whatwg.org/#syntaxerror)`"
`[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
If token contains any [ASCII whitespace](https://infra.spec.whatwg.org/#ascii-whitespace), then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an
"`[InvalidCharacterError](https://webidl.spec.whatwg.org/#invalidcharactererror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
[For each](https://infra.spec.whatwg.org/#list-iterate) token of tokens: [append](https://infra.spec.whatwg.org/#set-append) token to [this](https://webidl.spec.whatwg.org/#this)’s token set.
Run the update steps.
The
`remove(tokens…)`
method steps are:
[For each](https://infra.spec.whatwg.org/#list-iterate) token of tokens:
If token is the empty string, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[SyntaxError](https://webidl.spec.whatwg.org/#syntaxerror)`"
`[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
If token contains any [ASCII whitespace](https://infra.spec.whatwg.org/#ascii-whitespace), then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an
"`[InvalidCharacterError](https://webidl.spec.whatwg.org/#invalidcharactererror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
For each token of tokens: [remove](https://infra.spec.whatwg.org/#list-remove) token from
[this](https://webidl.spec.whatwg.org/#this)’s token set.
Run the update steps.
The `toggle(token, force)`
method steps are:
If token is the empty string, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a "`[SyntaxError](https://webidl.spec.whatwg.org/#syntaxerror)`"
`[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
If token contains any [ASCII whitespace](https://infra.spec.whatwg.org/#ascii-whitespace), then [throw](https://webidl.spec.whatwg.org/#dfn-throw) an
"`[InvalidCharacterError](https://webidl.spec.whatwg.org/#invalidcharactererror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
If [this](https://webidl.spec.whatwg.org/#this)’s token set[token] [exists](https://infra.spec.whatwg.org/#list-contain):
If force is either not given or is false, then [remove](https://infra.spec.whatwg.org/#list-remove) token from [this](https://webidl.spec.whatwg.org/#this)’s token set, run the update steps and return
false.
Return true.
Otherwise, if force not given or is true, [append](https://infra.spec.whatwg.org/#set-append) token
to [this](https://webidl.spec.whatwg.org/#this)’s token set, run the update steps, and return true.
Return false.
The update steps are not always run for `toggle()`
for web compatibility.
The
`replace(token, newToken)`
method steps are:
If either token or newToken is the empty string, then [throw](https://webidl.spec.whatwg.org/#dfn-throw) a
"`[SyntaxError](https://webidl.spec.whatwg.org/#syntaxerror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
If either token or newToken contains any [ASCII whitespace](https://infra.spec.whatwg.org/#ascii-whitespace), then
[throw](https://webidl.spec.whatwg.org/#dfn-throw) an "`[InvalidCharacterError](https://webidl.spec.whatwg.org/#invalidcharactererror)`" `[DOMException](https://webidl.spec.whatwg.org/#idl-DOMException)`.
If [this](https://webidl.spec.whatwg.org/#this)’s token set does not [contain](https://infra.spec.whatwg.org/#list-contain) token, then
return false.
[Replace](https://infra.spec.whatwg.org/#set-replace) token in [this](https://webidl.spec.whatwg.org/#this)’s token set with
newToken.
Run the update steps.
Return true.
The update steps are not always run for `replace()`
for web compatibility.
The
`supports(token)`
method steps are:
Let result be the return value of validation steps called with
token.
Return result.
The `value` getter steps are to return the
result of running [this](https://webidl.spec.whatwg.org/#this)’s serialize steps.
The `value` setter steps are to
set an attribute value for [this](https://webidl.spec.whatwg.org/#this)’s element using [this](https://webidl.spec.whatwg.org/#this)’s
attribute name and the given value.
8. XPath DOM Level 3 XPath defined an API for evaluating XPath 1.0
expressions. These APIs are widely implemented, but have not been maintained. The interface
definitions are maintained here so that they can be updated when Web IDL changes.
Complete definitions of these APIs remain necessary and such work is tracked and can be contributed
to in [whatwg/dom#67](https://github.com/whatwg/dom/issues/67). [DOM-Level-3-XPath] [XPath] [WEBIDL] 8.1. Interface `XPathResult` [[Exposed](https://webidl.spec.whatwg.org/#Exposed)=Window]
interface `XPathResult` {
const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `ANY_TYPE` = 0;
const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `NUMBER_TYPE` = 1;
const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `STRING_TYPE` = 2;
const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `BOOLEAN_TYPE` = 3;
const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `UNORDERED_NODE_ITERATOR_TYPE` = 4;
const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `ORDERED_NODE_ITERATOR_TYPE` = 5;
const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `UNORDERED_NODE_SNAPSHOT_TYPE` = 6;
const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `ORDERED_NODE_SNAPSHOT_TYPE` = 7;
const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `ANY_UNORDERED_NODE_TYPE` = 8;
const [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `FIRST_ORDERED_NODE_TYPE` = 9;
readonly attribute [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `resultType`;
readonly attribute [unrestricted double](https://webidl.spec.whatwg.org/#idl-unrestricted-double) `numberValue`;
readonly attribute [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `stringValue`;
readonly attribute [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `booleanValue`;
readonly attribute Node? `singleNodeValue`;
readonly attribute [boolean](https://webidl.spec.whatwg.org/#idl-boolean) `invalidIteratorState`;
readonly attribute [unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `snapshotLength`;
Node? `iterateNext`();
Node? `snapshotItem`([unsigned long](https://webidl.spec.whatwg.org/#idl-unsigned-long) `index`);
};
8.2. Interface `XPathExpression` [[Exposed](https://webidl.spec.whatwg.org/#Exposed)=Window]
interface `XPathExpression` {
// XPathResult.ANY_TYPE = 0
XPathResult `evaluate`(Node `contextNode`, optional [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `type` = 0, optional XPathResult? `result` = null);
};
8.3. Mixin `XPathEvaluatorBase` callback interface `XPathNSResolver` {
[DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `lookupNamespaceURI`([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString)? `prefix`);
};
interface mixin `XPathEvaluatorBase` {
[[NewObject](https://webidl.spec.whatwg.org/#NewObject)] XPathExpression `createExpression`([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `expression`, optional XPathNSResolver? `resolver` = null);
Node createNSResolver(Node `nodeResolver`); // legacy
// XPathResult.ANY_TYPE = 0
XPathResult `evaluate`([DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `expression`, Node `contextNode`, optional XPathNSResolver? `resolver` = null, optional [unsigned short](https://webidl.spec.whatwg.org/#idl-unsigned-short) `type` = 0, optional XPathResult? `result` = null);
};
Document includes XPathEvaluatorBase;
The
`createNSResolver(nodeResolver)`
method steps are to return nodeResolver.
This method exists only for historical reasons.
8.4. Interface `XPathEvaluator` [[Exposed](https://webidl.spec.whatwg.org/#Exposed)=Window]
interface `XPathEvaluator` {
`constructor`();
};
XPathEvaluator includes XPathEvaluatorBase;
For historical reasons you can both construct `XPathEvaluator` and access the same
methods on `Document`.
9. XSLT Avoid using client-side XSLT in browsers. The browser implementations of XSLT
are highly susceptible to memory safety vulnerabilities, and the web platform has evolved toward
JavaScript as the safe replacement. For these reasons, this feature is in the process of being
removed from the web platform. (This is a long process that takes many years.)
XSL Transformations (XSLT) is a language for transforming XML documents
into other XML documents. The APIs defined in this section have been widely implemented, and are
maintained here so that they can be updated when Web IDL changes. Complete definitions
of these APIs remain necessary and such work is tracked and can be contributed to in
[whatwg/dom#181](https://github.com/whatwg/dom/issues/181). [XSLT] 9.1. Interface `XSLTProcessor` [[Exposed](https://webidl.spec.whatwg.org/#Exposed)=Window]
interface `XSLTProcessor` {
`constructor`();
[undefined](https://webidl.spec.whatwg.org/#idl-undefined) `importStylesheet`(Node `style`);
[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)] DocumentFragment `transformToFragment`(Node `source`, Document `output`);
[[CEReactions](https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions)] Document `transformToDocument`(Node `source`);
[undefined](https://webidl.spec.whatwg.org/#idl-undefined) `setParameter`([[LegacyNullToEmptyString](https://webidl.spec.whatwg.org/#LegacyNullToEmptyString)] [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `namespaceURI`, [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `localName`, [any](https://webidl.spec.whatwg.org/#idl-any) `value`);
[any](https://webidl.spec.whatwg.org/#idl-any) `getParameter`([[LegacyNullToEmptyString](https://webidl.spec.whatwg.org/#LegacyNullToEmptyString)] [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `namespaceURI`, [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `localName`);
[undefined](https://webidl.spec.whatwg.org/#idl-undefined) `removeParameter`([[LegacyNullToEmptyString](https://webidl.spec.whatwg.org/#LegacyNullToEmptyString)] [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `namespaceURI`, [DOMString](https://webidl.spec.whatwg.org/#idl-DOMString) `localName`);
[undefined](https://webidl.spec.whatwg.org/#idl-undefined) `clearParameters`();
[undefined](https://webidl.spec.whatwg.org/#idl-undefined) `reset`();
};
10. Security and privacy considerations There are no known security or privacy considerations for this standard.
11. Historical This standard used to contain several interfaces and interface members that have been removed.
These interfaces have been removed:
`DOMConfiguration` `DOMError` `DOMErrorHandler` `DOMImplementationList` `DOMImplementationSource` `DOMLocator` `DOMObject` `DOMUserData` `Entity` `EntityReference` `MutationEvent` `MutationNameEvent` `NameList` `Notation` `RangeException` `TypeInfo` `UserDataHandler` And these interface members have been removed:
`Attr` `schemaTypeInfo` `isId`
`Document` `createEntityReference()` `xmlEncoding` `xmlStandalone` `xmlVersion` `strictErrorChecking` `domConfig` `normalizeDocument()` `renameNode()`
`DocumentType` `entities` `notations` `internalSubset`
`DOMImplementation` `getFeature()`
`Element` `schemaTypeInfo` `setIdAttribute()` `setIdAttributeNS()` `setIdAttributeNode()`
`Node` `isSupported` `getFeature()` `getUserData()` `setUserData()`
`NodeIterator` `expandEntityReferences`
`Text` `isElementContentWhitespace` `replaceWholeText()`
`TreeWalker` `expandEntityReferences` Acknowledgments There have been a lot of people that have helped make DOM more interoperable over the years and
thereby furthered the goals of this standard. Likewise many people have helped making this standard
what it is today.
With that, many thanks to
Adam Klein,
Adrian Bateman,
Ahmid *snuggs*,
Alex Komoroske,
Alex Russell,
Alexey Shvayka,
Andreas Kling,
Andreu Botella,
Anthony Ramine,
Arkadiusz Michalski,
Armen Michaeli,
Arnaud Le Hors,
Arun Ranganathan,
Benjamin Gruenbaum,
Björn Höhrmann,
Boris Zbarsky,
Brandon Payton,
Brandon Slade,
Brandon Wallace,
Brian Kardell,
C. Scott Ananian,
Cameron McCormack,
Chris Dumez,
Chris Paris,
Chris Rebert,
Cyrille Tuzi,
Dan Burzo,
Daniel Clark,
Daniel Glazman,
Darien Maillet Valentine,
Darin Fisher,
David Baron,
David Bruant,
David Flanagan,
David Håsäther,
David Hyatt,
Deepak Sherveghar,
Dethe Elza,
Dimitri Glazkov,
Domenic Denicola,
Dominic Cooney,
Dominique Hazaël-Massieux,
Don Jordan,
Doug Schepers,
Edgar Chen,
Elisée Maurer,
Elliott Sprehn,
Emilio Cobos Álvarez,
Eric Bidelman,
Erik Arvidsson,
Evgeny Kapun,
François Daoust,
François Remy,
Gary Kacmarcik,
Gavin Nicol,
Giorgio Liscio,
Glen Huang,
Glenn Adams,
Glenn Maynard,
Hajime Morrita,
Harald Alvestrand,
Hayato Ito,
Henri Sivonen,
Hongchan Choi,
Hunan Rostomyan,
Ian Hickson,
Igor Bukanov,
Jacob Rossi,
Jake Archibald,
Jake Verbaten,
James Graham,
James Greene,
James M Snell,
James Robinson,
Jayson Chen,
Jeffrey Yasskin,
Jens Lindström,
Jeremy Davis,
Jesse McCarthy,
Jinho Bang,
João Eiras,
Joe Kesselman,
John Atkins,
John Dai,
Jonas Sicking,
Jonathan Kingston,
Jonathan Robie,
Joris van der Wel,
Joshua Bell,
J. S. Choi,
Jungkee Song,
Justin Summerlin,
Kagami Sascha Rosylight,
呂康豪 (Kang-Hao Lu),
田村健人 (Kent TAMURA),
Kevin J. Sung,
Kevin Sweeney,
Kirill Topolyan,
Koji Ishii,
Lachlan Hunt,
Lauren Wood,
Luca Casonato,
Luke Zielinski,
Magne Andersson,
Majid Valipour,
Malte Ubl,
Manish Goregaokar,
Manish Tripathi,
Marcos Caceres,
Mark Miller,
Martijn van der Ven,
Mason Freed,
Mats Palmgren,
Mounir Lamouri,
Michael Stramel,
Michael™ Smith,
Mike Champion,
Mike Taylor,
Mike West,
Nicolás Peña Moreno,
Nidhi Jaju,
Ojan Vafai,
Oliver Nightingale,
Olli Pettay,
Ondřej Žára,
Peter Sharpe,
Philip Jägenstedt,
Philippe Le Hégaret,
Piers Wombwell,
Pierre-Marie Dartus,
prosody—Gab Vereable Context(,
Rafael Weinstein,
Rakina Zata Amni,
Richard Bradshaw,
Rick Byers,
Rick Waldron,
Robbert Broersma,
Robin Berjon,
Roland Steiner,
Rune F. Halvorsen,
Russell Bicknell,
Ruud Steltenpool,
Ryosuke Niwa,
Sam Dutton,
Sam Sneddon,
Samuel Giles,
Sanket Joshi,
Scott Haseley,
Sebastian Mayr,
Seo Sanghyeon,
Sergey G. Grekhov,
Shiki Okasaka,
Shinya Kawanaka,
Simon Pieters,
Simon Wülker,
Stef Busking,
Steve Byrne,
Steven Obiajulu,
Stig Halvorsen,
Tab Atkins,
Takashi Sakamoto,
Takayoshi Kochi,
Theresa O’Connor,
Theodore Dubois,
*timeless*,
Timo Tijhof,
Tobie Langel,
Tom Pixley,
Travis Leithead,
Trevor Rowbotham,
*triple-underscore*,
Tristan Fraipont,
Veli Şenol,
Vidur Apparao,
Warren He,
Xidorn Quan,
Yash Handa,
Yehuda Katz,
Yoav Weiss,
Yoichi Osato,
Yoshinori Sano,
Yu Han,
Yusuke Abe, and
Zack Weinberg
for being awesome!
This standard is written by [Anne van Kesteren](https://annevankesteren.nl/)
([Apple](https://www.apple.com/), [annevk@annevk.nl](mailto:annevk@annevk.nl))
with substantial contributions from Aryeh Gregor ([ayg@aryeh.name](mailto:ayg@aryeh.name))
and Ms2ger ([ms2ger@gmail.com](mailto:ms2ger@gmail.com)).
Intellectual property rights Part of the revision history of the integration points related to
custom elements can be found in
[the w3c/webcomponents repository](https://github.com/w3c/webcomponents), which is
available under the
[W3C Software and Document License](https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document).
Copyright © WHATWG (Apple, Google, Mozilla, Microsoft). This work is licensed under a [Creative Commons Attribution 4.0
International License](https://creativecommons.org/licenses/by/4.0/). To the extent portions of it are incorporated into source code, such
portions in the source code are licensed under the [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause) instead. This is the Living Standard. Those
interested in the patent-review version should view the
[Living Standard Review Draft](/review-drafts/2026-06/).
## Index
### Terms defined by this specification
- abort , in § 3.2
- abort()
- method for AbortController , in § 3.1
- method for AbortSignal , in § 3.2
- abort algorithms , in § 3.2
- AbortController , in § 3.1
- AbortController() , in § 3.1
- aborted
- attribute for AbortSignal , in § 3.2
- dfn for AbortSignal , in § 3.2
- abort reason , in § 3.2
- abort(reason)
- method for AbortController , in § 3.1
- method for AbortSignal , in § 3.2
- AbortSignal , in § 3.2
- AbstractRange , in § 5.3
- acceptNode(node) , in § 6.3
- activation behavior , in § 2.7
- add , in § 3.2
- add() , in § 7.1
- add an event listener , in § 2.7
- addedNodes , in § 4.3.3
- AddEventListenerOptions , in § 2.7
- addEventListener(type, callback) , in § 2.7
- addEventListener(type, callback, options) , in § 2.7
- add(...tokens) , in § 7.1
- add(tokens) , in § 7.1
- adjust a node pointer , in § 6.1
- adopt , in § 4.5
- adopting steps , in § 4.5
- adoptNode(node) , in § 4.5
- after , in § 5.2
- after() , in § 4.2.8
- after(...nodes) , in § 4.2.8
- allow declarative shadow roots , in § 4.5
- ancestor , in § 1.1
- any(signals) , in § 3.2
- ANY_TYPE , in § 8.1
- ANY_UNORDERED_NODE_TYPE , in § 8.1
- append , in § 4.2.3
- append() , in § 4.2.6
- append an attribute , in § 4.9
- appendChild(node) , in § 4.4
- appendData(data) , in § 4.10
- append(...nodes) , in § 4.2.6
- append to an event path , in § 2.9
- assign a slot , in § 4.2.2.4
- assigned , in § 4.2.2.2
- assigned nodes , in § 4.2.2.1
- assigned slot , in § 4.2.2.2
- assignedSlot , in § 4.2.9
- assign slottables , in § 4.2.2.4
- assign slottables for a tree , in § 4.2.2.4
- attach a shadow root , in § 4.9
- attachShadow(init) , in § 4.9
- AT_TARGET , in § 2.2
- Attr , in § 4.9.2
- attribute , in § 4.9.2
- attribute change steps , in § 4.9
- attributeFilter , in § 4.3.1
- attribute list
- dfn for Element , in § 4.9
- dfn for NamedNodeMap , in § 4.9.1
- attribute map , in § 4.13
- attribute name , in § 7.1
- attributeName , in § 4.3.3
- attributeNamespace , in § 4.3.3
- ATTRIBUTE_NODE , in § 4.4
- attributeOldValue , in § 4.3.1
- attributes
- attribute for Element , in § 4.9
- dict-member for MutationObserverInit , in § 4.3.1
- available to element internals , in § 4.8
- baseURI , in § 4.4
- before , in § 5.2
- before() , in § 4.2.8
- before(...nodes) , in § 4.2.8
- BOOLEAN_TYPE , in § 8.1
- booleanValue , in § 8.1
- boundary point , in § 5.2
- bubbles
- attribute for Event , in § 2.2
- dict-member for EventInit , in § 2.2
- BUBBLING_PHASE , in § 2.2
- callback
- dfn for MutationObserver , in § 4.3.1
- dfn for event listener , in § 2.7
- cancelable
- attribute for Event , in § 2.2
- dict-member for EventInit , in § 2.2
- cancelBubble , in § 2.2
- canceled flag , in § 2.2
- candidate reference , in § 6.1
- capture
- dfn for event listener , in § 2.7
- dict-member for EventListenerOptions , in § 2.7
- CAPTURING_PHASE , in § 2.2
- CDATASection , in § 4.12
- CDATA_SECTION_NODE , in § 4.4
- change an attribute , in § 4.9
- CharacterData , in § 4.10
- characterData , in § 4.3.1
- characterDataOldValue , in § 4.3.1
- characterSet , in § 4.5
- charset , in § 4.5
- child , in § 1.1
- childElementCount , in § 4.2.6
- childList , in § 4.3.1
- ChildNode , in § 4.2.8
- childNodes , in § 4.4
- children
- attribute for ParentNode , in § 4.2.6
- dfn for tree , in § 1.1
- children changed steps , in § 4.2.3
- child text content , in § 4.11
- class , in § 4.9
- classList , in § 4.9
- className , in § 4.9
- clearParameters() , in § 9.1
- clonable
- attribute for ShadowRoot , in § 4.8
- dfn for ShadowRoot , in § 4.8
- dict-member for ShadowRootInit , in § 4.9
- clone a node , in § 4.4
- clone a single node , in § 4.4
- cloneContents() , in § 5.5
- cloneNode() , in § 4.4
- cloneNode(subtree) , in § 4.4
- cloneRange() , in § 5.5
- clone the contents , in § 5.5
- cloning steps , in § 4.4
- cloning the contents , in § 5.5
- "closed" , in § 4.8
- closed-shadow-hidden , in § 4.8
- closest(selectors) , in § 4.9
- collapse() , in § 5.5
- collapsed
- attribute for AbstractRange , in § 5.3
- dfn for range , in § 5.3
- collapse(toStart) , in § 5.5
- collection , in § 4.2.10
- Comment , in § 4.14
- Comment() , in § 4.14
- Comment(data) , in § 4.14
- COMMENT_NODE , in § 4.4
- commonAncestorContainer , in § 5.5
- compareBoundaryPoints(how, sourceRange) , in § 5.5
- compareDocumentPosition(other) , in § 4.4
- comparePoint(node, offset) , in § 5.5
- compatMode , in § 4.5
- composed
- attribute for Event , in § 2.2
- dict-member for EventInit , in § 2.2
- dict-member for GetRootNodeOptions , in § 4.4
- composed flag , in § 2.2
- composedPath() , in § 2.2
- connected , in § 4.2.2
- constructor , in § 2.5
- constructor()
- constructor for AbortController , in § 3.1
- constructor for Comment , in § 4.14
- constructor for Document , in § 4.5
- constructor for DocumentFragment , in § 4.7
- constructor for EventTarget , in § 2.7
- constructor for Range , in § 5.5
- constructor for Text , in § 4.11
- constructor for XPathEvaluator , in § 8.4
- constructor for XSLTProcessor , in § 9.1
- constructor(callback) , in § 4.3.1
- constructor(data)
- constructor for Comment , in § 4.14
- constructor for Text , in § 4.11
- constructor(init) , in § 5.4
- constructor(target) , in § 4.13
- constructor(target, data) , in § 4.13
- constructor(type)
- constructor for CustomEvent , in § 2.4
- constructor for Event , in § 2.2
- constructor(type, eventInitDict)
- constructor for CustomEvent , in § 2.4
- constructor for Event , in § 2.2
- contained , in § 5.5
- contains(other) , in § 4.4
- contains(token) , in § 7.1
- content type , in § 4.5
- contentType , in § 4.5
- contiguous exclusive Text nodes , in § 4.11
- contiguous Text nodes , in § 4.11
- convert nodes into a node , in § 4.2.6
- create a comment node , in § 4.14
- create a dependent abort signal , in § 3.2
- create a doctype , in § 4.6
- create a document , in § 4.5
- create a document fragment , in § 4.7
- create an attribute , in § 4.9.2
- create an element , in § 4.9
- create an element internal , in § 4.9
- create an event , in § 2.5
- create a node , in § 4.4
- create a processing instruction node , in § 4.13
- create a text node , in § 4.11
- createAttribute(localName) , in § 4.5
- createAttributeNS(namespace, qualifiedName) , in § 4.5
- createCDATASection(data) , in § 4.5
- createComment(data) , in § 4.5
- createDocumentFragment() , in § 4.5
- createDocument(namespace, qualifiedName) , in § 4.5.1
- createDocument(namespace, qualifiedName, doctype) , in § 4.5.1
- createDocumentType(name, publicId, systemId) , in § 4.5.1
- createElement(localName) , in § 4.5
- createElement(localName, options) , in § 4.5
- createElementNS(namespace, qualifiedName) , in § 4.5
- createElementNS(namespace, qualifiedName, options) , in § 4.5
- createEntityReference() , in § 11
- createEvent(interface) , in § 4.5
- createExpression(expression) , in § 8.3
- createExpression(expression, resolver) , in § 8.3
- createHTMLDocument() , in § 4.5.1
- createHTMLDocument(title) , in § 4.5.1
- createNodeIterator(root) , in § 4.5
- createNodeIterator(root, whatToShow) , in § 4.5
- createNodeIterator(root, whatToShow, filter) , in § 4.5
- createNSResolver(nodeResolver) , in § 8.3
- createProcessingInstruction(target, data) , in § 4.5
- createRange() , in § 4.5
- createTextNode(data) , in § 4.5
- createTreeWalker(root) , in § 4.5
- createTreeWalker(root, whatToShow) , in § 4.5
- createTreeWalker(root, whatToShow, filter) , in § 4.5
- creating an event , in § 2.5
- current , in § 6.2
- current event , in § 2.3
- currentNode , in § 6.2
- currentTarget , in § 2.2
- custom , in § 4.9
- custom element definition , in § 4.9
- custom element registry
- dfn for Document , in § 4.5
- dfn for Element , in § 4.9
- dfn for ShadowRoot , in § 4.8
- customElementRegistry
- attribute for DocumentOrShadowRoot , in § 4.2.5
- attribute for Element , in § 4.9
- dict-member for ElementCreationOptions , in § 4.5
- dict-member for ImportNodeOptions , in § 4.5
- dict-member for ShadowRootInit , in § 4.9
- custom element state , in § 4.9
- CustomEvent , in § 2.4
- CustomEventInit , in § 2.4
- CustomEvent(type) , in § 2.4
- CustomEvent(type, eventInitDict) , in § 2.4
- data
- attribute for CharacterData , in § 4.10
- dfn for CharacterData , in § 4.10
- declarative , in § 4.8
- default passive value , in § 2.7
- defaultPrevented , in § 2.2
- defined , in § 4.9
- delegates focus , in § 4.8
- delegatesFocus
- attribute for ShadowRoot , in § 4.8
- dict-member for ShadowRootInit , in § 4.9
- deleteContents() , in § 5.5
- deleteData(offset, count) , in § 4.10
- dependent , in § 3.2
- dependent signals , in § 3.2
- descendant , in § 1.1
- descendant text content , in § 4.11
- detach()
- method for NodeIterator , in § 6.1
- method for Range , in § 5.5
- detail
- attribute for CustomEvent , in § 2.4
- dict-member for CustomEventInit , in § 2.4
- disconnect() , in § 4.3.1
- dispatch , in § 2.9
- dispatchEvent(event) , in § 2.7
- dispatch flag , in § 2.2
- doctype
- attribute for Document , in § 4.5
- definition of , in § 4.6
- Document , in § 4.5
- document
- definition of , in § 4.5
- dfn for clone a node , in § 4.4
- Document() , in § 4.5
- document element , in § 4.2.1
- documentElement , in § 4.5
- DocumentFragment , in § 4.7
- DocumentFragment() , in § 4.7
- DOCUMENT_FRAGMENT_NODE , in § 4.4
- DOCUMENT_NODE , in § 4.4
- DocumentOrShadowRoot , in § 4.2.5
- DOCUMENT_POSITION_CONTAINED_BY , in § 4.4
- DOCUMENT_POSITION_CONTAINS , in § 4.4
- DOCUMENT_POSITION_DISCONNECTED , in § 4.4
- DOCUMENT_POSITION_FOLLOWING , in § 4.4
- DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC , in § 4.4
- DOCUMENT_POSITION_PRECEDING , in § 4.4
- document tree , in § 4.2.1
- DocumentType , in § 4.6
- DOCUMENT_TYPE_NODE , in § 4.4
- documentURI , in § 4.5
- domConfig , in § 11
- DOMConfiguration , in § 11
- DOMError , in § 11
- DOMErrorHandler , in § 11
- DOMImplementation , in § 4.5.1
- DOMImplementationList , in § 11
- DOMImplementationSource , in § 11
- DOMLocator , in § 11
- DOMObject , in § 11
- DOMTokenList , in § 7.1
- DOMUserData , in § 11
- effective global custom element registry , in § 4.5
- Element , in § 4.9
- element
- definition of , in § 4.9
- dfn for Attr , in § 4.9.2
- dfn for DOMTokenList , in § 7.1
- dfn for NamedNodeMap , in § 4.9.1
- ElementCreationOptions , in § 4.5
- element interface , in § 4.5
- ELEMENT_NODE , in § 4.4
- empty , in § 4.2
- encoding , in § 4.5
- end , in § 5.3
- endContainer
- attribute for AbstractRange , in § 5.3
- dict-member for StaticRangeInit , in § 5.4
- end node , in § 5.3
- end offset , in § 5.3
- endOffset
- attribute for AbstractRange , in § 5.3
- dict-member for StaticRangeInit , in § 5.4
- END_TO_END , in § 5.5
- END_TO_START , in § 5.5
- ensure pre-insert validity , in § 4.2.3
- entities , in § 11
- Entity , in § 11
- ENTITY_NODE , in § 4.4
- EntityReference , in § 11
- ENTITY_REFERENCE_NODE , in § 4.4
- equal , in § 5.2
- equals , in § 4.4
- evaluate(contextNode) , in § 8.2
- evaluate(contextNode, type) , in § 8.2
- evaluate(contextNode, type, result) , in § 8.2
- evaluate(expression, contextNode) , in § 8.3
- evaluate(expression, contextNode, resolver) , in § 8.3
- evaluate(expression, contextNode, resolver, type) , in § 8.3
- evaluate(expression, contextNode, resolver, type, result) , in § 8.3
- Event , in § 2.2
- event
- attribute for Window , in § 2.3
- definition of , in § 2.2
- event constructing steps , in § 2.5
- EventInit , in § 2.2
- event listener , in § 2.7
- EventListener , in § 2.7
- event listener list , in § 2.7
- EventListenerOptions , in § 2.7
- event path item , in § 2.2
- eventPhase , in § 2.2
- EventTarget , in § 2.7
- EventTarget() , in § 2.7
- Event(type) , in § 2.2
- Event(type, eventInitDict) , in § 2.2
- exclusive DocumentFragment node , in § 4.7
- exclusive Text node , in § 4.11
- expandEntityReferences
- attribute for NodeIterator , in § 11
- attribute for TreeWalker , in § 11
- extract , in § 5.5
- extractContents() , in § 5.5
- fallbackRegistry , in § 4.4
- filter
- attribute for NodeIterator , in § 6.1
- attribute for TreeWalker , in § 6.2
- definition of , in § 6
- dfn for traversal , in § 6
- FILTER_ACCEPT , in § 6.3
- FILTER_REJECT , in § 6.3
- FILTER_SKIP , in § 6.3
- find a slot , in § 4.2.2.3
- find flattened slottables , in § 4.2.2.3
- find slottables , in § 4.2.2.3
- fire an event , in § 2.10
- first child , in § 1.1
- firstChild , in § 4.4
- firstChild() , in § 6.2
- firstElementChild , in § 4.2.6
- FIRST_ORDERED_NODE_TYPE , in § 8.1
- flatten , in § 2.7
- flatten element creation options , in § 4.5
- flatten more , in § 2.7
- following , in § 1.1
- get an attribute by name , in § 4.9
- get an attribute by namespace and local name , in § 4.9
- get an attribute value , in § 4.9
- get an element by ID , in § 4.2.4
- get a processing instruction attribute , in § 4.13
- getAttribute(name) , in § 4.13
- getAttributeNames()
- method for Element , in § 4.9
- method for ProcessingInstruction , in § 4.13
- getAttributeNodeNS(namespace, localName) , in § 4.9
- getAttributeNode(qualifiedName) , in § 4.9
- getAttributeNS(namespace, localName) , in § 4.9
- getAttribute(qualifiedName) , in § 4.9
- getElementById(elementId) , in § 4.2.4
- getElementsByClassName(classNames)
- method for Document , in § 4.5
- method for Element , in § 4.9
- getElementsByTagNameNS(namespace, localName)
- method for Document , in § 4.5
- method for Element , in § 4.9
- getElementsByTagName(qualifiedName)
- method for Document , in § 4.5
- method for Element , in § 4.9
- getFeature()
- method for DOMImplementation , in § 11
- method for Node , in § 11
- getNamedItemNS(namespace, localName) , in § 4.9.1
- getNamedItem(qualifiedName) , in § 4.9.1
- getParameter(namespaceURI, localName) , in § 9.1
- getRootNode() , in § 4.4
- getRootNode(options) , in § 4.4
- GetRootNodeOptions , in § 4.4
- get text content , in § 4.4
- get the common ancestor , in § 5.5
- get the parent , in § 2.7
- getUserData() , in § 11
- handle attribute changes , in § 4.9
- handleEvent(event) , in § 2.7
- has an attribute , in § 4.9
- hasAttribute(name) , in § 4.13
- hasAttributeNS(namespace, localName) , in § 4.9
- hasAttribute(qualifiedName) , in § 4.9
- hasAttributes()
- method for Element , in § 4.9
- method for ProcessingInstruction , in § 4.13
- hasChildNodes() , in § 4.4
- hasFeature() , in § 4.5.1
- host
- attribute for ShadowRoot , in § 4.8
- dfn for DocumentFragment , in § 4.7
- host-including inclusive ancestor , in § 4.7
- HTMLCollection , in § 4.2.10.2
- HTML document , in § 4.5
- HTML-uppercased qualified name , in § 4.9
- ID , in § 4.9
- id , in § 4.9
- implementation , in § 4.5
- importNode(node) , in § 4.5
- importNode(node, options) , in § 4.5
- ImportNodeOptions , in § 4.5
- importStylesheet(style) , in § 9.1
- in a document , in § 4.2.1
- in a document tree , in § 4.2.1
- inclusive ancestor , in § 1.1
- inclusive descendant , in § 1.1
- inclusive sibling , in § 1.1
- index , in § 1.1
- initCustomEvent(type) , in § 2.4
- initCustomEvent(type, bubbles) , in § 2.4
- initCustomEvent(type, bubbles, cancelable) , in § 2.4
- initCustomEvent(type, bubbles, cancelable, detail) , in § 2.4
- initEvent(type) , in § 2.2
- initEvent(type, bubbles) , in § 2.2
- initEvent(type, bubbles, cancelable) , in § 2.2
- initialize
- dfn for Event , in § 2.2
- dfn for ProcessingInstruction , in § 4.13
- initialized flag , in § 2.2
- inner event creation steps , in § 2.5
- inner invoke , in § 2.9
- in passive listener flag , in § 2.2
- inputEncoding , in § 4.5
- insert
- definition of , in § 4.2.3
- dfn for live range , in § 5.5
- insert adjacent , in § 4.9
- insertAdjacentElement(where, element) , in § 4.9
- insertAdjacentText(where, data) , in § 4.9
- insertBefore(node, child) , in § 4.4
- insertData(offset, data) , in § 4.10
- insertion steps , in § 4.2.3
- insertNode(node) , in § 5.5
- internal createElementNS steps , in § 4.5
- internalSubset , in § 11
- intersectsNode(node) , in § 5.5
- invalidIteratorState , in § 8.1
- invocation target , in § 2.2
- invocation-target-in-shadow-tree , in § 2.2
- invoke , in § 2.9
- is , in § 4.5
- is active , in § 6
- is a global custom element registry , in § 4.5
- isConnected , in § 4.4
- isDefaultNamespace(namespace) , in § 4.4
- isElementContentWhitespace , in § 11
- isEqualNode(otherNode) , in § 4.4
- isId , in § 11
- isPointInRange(node, offset) , in § 5.5
- isSameNode(otherNode) , in § 4.4
- isSupported , in § 11
- isTrusted , in § 2.2
- is value , in § 4.9
- item(index)
- method for DOMTokenList , in § 7.1
- method for HTMLCollection , in § 4.2.10.2
- method for NamedNodeMap , in § 4.9.1
- method for NodeList , in § 4.2.10.1
- iterateNext() , in § 8.1
- iterator collection , in § 6.1
- keep custom element registry null , in § 4.8
- last child , in § 1.1
- lastChild , in § 4.4
- lastChild() , in § 6.2
- lastElementChild , in § 4.2.6
- legacy-canceled-activation behavior , in § 2.7
- legacy-obtain service worker fetch event listener callbacks , in § 2.8
- legacy-pre-activation behavior , in § 2.7
- length
- attribute for CharacterData , in § 4.10
- attribute for DOMTokenList , in § 7.1
- attribute for HTMLCollection , in § 4.2.10.2
- attribute for NamedNodeMap , in § 4.9.1
- attribute for NodeList , in § 4.2.10.1
- dfn for Node , in § 4.2
- light tree , in § 4.2.2
- limited-quirks mode , in § 4.5
- list of elements with class names classNames , in § 4.4
- list of elements with namespace namespace and local name localName , in § 4.4
- list of elements with qualified name qualifiedName , in § 4.4
- live , in § 4.2.10
- live collection , in § 4.2.10
- live range pre-remove steps , in § 5.5
- live ranges , in § 5.5
- local name
- dfn for Attr , in § 4.9.2
- dfn for Element , in § 4.9
- localName
- attribute for Attr , in § 4.9.2
- attribute for Element , in § 4.9
- locate a namespace , in § 4.4
- locate a namespace prefix , in § 4.4
- locating a namespace prefix , in § 4.4
- lookupNamespaceURI(prefix)
- method for Node , in § 4.4
- method for XPathNSResolver , in § 8.3
- lookupPrefix(namespace) , in § 4.4
- "manual" , in § 4.8
- manual slot assignment , in § 4.2.2.2
- matches(selectors) , in § 4.9
- mode
- attribute for ShadowRoot , in § 4.8
- dfn for Document , in § 4.5
- dfn for ShadowRoot , in § 4.8
- dict-member for ShadowRootInit , in § 4.9
- move , in § 4.2.3
- moveBefore(node, child) , in § 4.2.6
- moving steps , in § 4.2.3
- MutationCallback , in § 4.3.1
- MutationEvent , in § 11
- MutationNameEvent , in § 11
- MutationObserver , in § 4.3.1
- MutationObserver(callback) , in § 4.3.1
- MutationObserverInit , in § 4.3.1
- mutation observer microtask queued , in § 4.3
- MutationRecord , in § 4.3.3
- name
- attribute for Attr , in § 4.9.2
- attribute for DocumentType , in § 4.6
- dfn for DocumentType , in § 4.6
- dfn for slot , in § 4.2.2.1
- dfn for slottable , in § 4.2.2.2
- "named" , in § 4.8
- named attribute , in § 4.9.2
- namedItem(key) , in § 4.2.10.2
- namedItem(name) , in § 4.2.10.2
- NamedNodeMap , in § 4.9.1
- NameList , in § 11
- namespace
- dfn for Attr , in § 4.9.2
- dfn for Element , in § 4.9
- namespace prefix
- dfn for Attr , in § 4.9.2
- dfn for Element , in § 4.9
- namespaceURI
- attribute for Attr , in § 4.9.2
- attribute for Element , in § 4.9
- nextElementSibling , in § 4.2.7
- nextNode()
- method for NodeIterator , in § 6.1
- method for TreeWalker , in § 6.2
- next sibling , in § 1.1
- nextSibling
- attribute for MutationRecord , in § 4.3.3
- attribute for Node , in § 4.4
- nextSibling() , in § 6.2
- Node , in § 4.4
- node
- dfn for boundary point , in § 5.2
- dfn for node pointer , in § 6.1
- node document , in § 4.4
- NodeFilter , in § 6.3
- NodeIterator , in § 6.1
- NodeIterator pre-remove steps , in § 6.1
- node list , in § 4.3.1
- NodeList , in § 4.2.10.1
- nodeName , in § 4.4
- node pointer , in § 6.1
- Nodes , in § 4.2
- node tree , in § 4.2
- nodeType , in § 4.4
- nodeValue , in § 4.4
- NonDocumentTypeChildNode , in § 4.2.7
- NONE , in § 2.2
- NonElementParentNode , in § 4.2.4
- no-quirks mode , in § 4.5
- normalize() , in § 4.4
- normalizeDocument() , in § 11
- Notation , in § 11
- NOTATION_NODE , in § 4.4
- notations , in § 11
- notify mutation observers , in § 4.3
- NUMBER_TYPE , in § 8.1
- numberValue , in § 8.1
- observer , in § 4.3
- observe(target) , in § 4.3.1
- observe(target, options) , in § 4.3.1
- offset , in § 5.2
- oldValue , in § 4.3.3
- onabort
- attribute for AbortSignal , in § 3.2
- dfn for AbortSignal , in § 3.2
- once
- dfn for event listener , in § 2.7
- dict-member for AddEventListenerOptions , in § 2.7
- onslotchange
- attribute for ShadowRoot , in § 4.8
- dfn for ShadowRoot , in § 4.8
- "open" , in § 4.8
- options , in § 4.3
- ORDERED_NODE_ITERATOR_TYPE , in § 8.1
- ORDERED_NODE_SNAPSHOT_TYPE , in § 8.1
- ordered set parser , in § 1.2
- ordered set serializer , in § 1.2
- origin , in § 4.5
- other applicable specifications , in § 1
- ownerDocument , in § 4.4
- ownerElement , in § 4.9.2
- parent
- dfn for clone a node , in § 4.4
- dfn for tree , in § 1.1
- parent element , in § 4.9
- parentElement , in § 4.4
- ParentNode , in § 4.2.6
- parentNode , in § 4.4
- parentNode() , in § 6.2
- partially contained , in § 5.5
- participate , in § 1.1
- participate in a tree , in § 1.1
- participates in a tree , in § 1.1
- passive
- dfn for event listener , in § 2.7
- dict-member for AddEventListenerOptions , in § 2.7
- path , in § 2.2
- pending mutation observers , in § 4.3
- pointer before , in § 6.1
- pointerBeforeReferenceNode , in § 6.1
- position , in § 5.2
- post-connection steps , in § 4.2.3
- potential event target , in § 2.2
- preceding , in § 1.1
- prefix
- attribute for Attr , in § 4.9.2
- attribute for Element , in § 4.9
- pre-insert , in § 4.2.3
- prepend() , in § 4.2.6
- prepend(...nodes) , in § 4.2.6
- pre-remove , in § 4.2.3
- preventDefault() , in § 2.2
- previousElementSibling , in § 4.2.7
- previousNode()
- method for NodeIterator , in § 6.1
- method for TreeWalker , in § 6.2
- previous sibling , in § 1.1
- previousSibling
- attribute for MutationRecord , in § 4.3.3
- attribute for Node , in § 4.4
- previousSibling() , in § 6.2
- ProcessingInstruction , in § 4.13
- PROCESSING_INSTRUCTION_NODE , in § 4.4
- ProcessingInstruction(target) , in § 4.13
- ProcessingInstruction(target, data) , in § 4.13
- public ID , in § 4.6
- publicId , in § 4.6
- qualified name
- dfn for Attr , in § 4.9.2
- dfn for Element , in § 4.9
- querySelectorAll(selectors) , in § 4.2.6
- querySelector(selectors) , in § 4.2.6
- queue a mutation observer microtask , in § 4.3
- queue a mutation record , in § 4.3.2
- queue a tree mutation record , in § 4.3.2
- quirks mode , in § 4.5
- Range , in § 5.5
- range , in § 5.3
- Range() , in § 5.5
- RangeException , in § 11
- reason , in § 3.2
- record queue , in § 4.3.1
- reference , in § 6.1
- referenceNode , in § 6.1
- reflect , in § 4.9
- registered observer , in § 4.3
- registered observer list , in § 4.3
- relatedTarget
- dfn for Event , in § 2.2
- dfn for event path item , in § 2.2
- remove
- definition of , in § 4.2.3
- dfn for AbortSignal , in § 3.2
- remove()
- method for ChildNode , in § 4.2.8
- method for DOMTokenList , in § 7.1
- remove all event listeners , in § 2.7
- remove an attribute , in § 4.9
- remove an attribute by name , in § 4.9
- remove an attribute by namespace and local name , in § 4.9
- remove an event listener , in § 2.7
- removeAttribute(name) , in § 4.13
- removeAttributeNode(attr) , in § 4.9
- removeAttributeNS(namespace, localName) , in § 4.9
- removeAttribute(qualifiedName) , in § 4.9
- removeChild(child) , in § 4.4
- removed , in § 2.7
- removedNodes , in § 4.3.3
- removeEventListener(type, callback) , in § 2.7
- removeEventListener(type, callback, options) , in § 2.7
- removeNamedItemNS(namespace, localName) , in § 4.9.1
- removeNamedItem(qualifiedName) , in § 4.9.1
- removeParameter(namespaceURI, localName) , in § 9.1
- remove(...tokens) , in § 7.1
- remove(tokens) , in § 7.1
- removing steps , in § 4.2.3
- renameNode() , in § 11
- replace , in § 4.2.3
- replace all , in § 4.2.3
- replace an attribute , in § 4.9
- replaceChild(node, child) , in § 4.4
- replaceChildren() , in § 4.2.6
- replaceChildren(...nodes) , in § 4.2.6
- replace data , in § 4.10
- replaceData(offset, count, data) , in § 4.10
- replace(token, newToken) , in § 7.1
- replaceWholeText() , in § 11
- replaceWith() , in § 4.2.8
- replaceWith(...nodes) , in § 4.2.8
- represented by the collection , in § 4.2.10
- reset() , in § 9.1
- resultType , in § 8.1
- retarget , in § 4.8
- retargeting , in § 4.8
- returnValue , in § 2.2
- root
- attribute for NodeIterator , in § 6.1
- attribute for TreeWalker , in § 6.2
- dfn for live range , in § 5.5
- dfn for traversal , in § 6
- dfn for tree , in § 1.1
- root-of-closed-tree , in § 2.2
- run the abort steps , in § 3.2
- schemaTypeInfo
- attribute for Attr , in § 11
- attribute for Element , in § 11
- scope-match a selectors string , in § 1.3
- select , in § 5.5
- selectNodeContents(node) , in § 5.5
- selectNode(node) , in § 5.5
- selfOnly , in § 4.5
- serializable
- attribute for ShadowRoot , in § 4.8
- dfn for ShadowRoot , in § 4.8
- dict-member for ShadowRootInit , in § 4.9
- serialize steps , in § 7.1
- set an attribute , in § 4.9
- set an attribute value , in § 4.9
- set an existing attribute value , in § 4.9.2
- setAttribute(name, value) , in § 4.13
- setAttributeNode(attr) , in § 4.9
- setAttributeNodeNS(attr) , in § 4.9
- setAttributeNS(namespace, qualifiedName, value) , in § 4.9
- setAttribute(qualifiedName, value) , in § 4.9
- setEndAfter(node) , in § 5.5
- setEndBefore(node) , in § 5.5
- setEnd(node, offset) , in § 5.5
- setIdAttribute() , in § 11
- setIdAttributeNode() , in § 11
- setIdAttributeNS() , in § 11
- setNamedItem(attr) , in § 4.9.1
- setNamedItemNS(attr) , in § 4.9.1
- setParameter(namespaceURI, localName, value) , in § 9.1
- setStartAfter(node) , in § 5.5
- setStartBefore(node) , in § 5.5
- setStart(node, offset) , in § 5.5
- set text content , in § 4.4
- set the canceled flag , in § 2.2
- set the end , in § 5.5
- set the start , in § 5.5
- setUserData() , in § 11
- shadow-adjusted target , in § 2.2
- shadow host , in § 4.9
- shadow-including ancestor , in § 4.8
- shadow-including descendant , in § 4.8
- shadow-including inclusive ancestor , in § 4.8
- shadow-including inclusive descendant , in § 4.8
- Shadow-including preorder, depth-first traversal , in § 4.8
- shadow-including root , in § 4.8
- shadow-including tree order , in § 4.8
- shadow root
- definition of , in § 4.8
- dfn for Element , in § 4.9
- ShadowRoot , in § 4.8
- shadowRoot , in § 4.9
- ShadowRootInit , in § 4.9
- ShadowRootMode , in § 4.8
- shadow tree , in § 4.2.2
- SHOW_ALL , in § 6.3
- SHOW_ATTRIBUTE , in § 6.3
- SHOW_CDATA_SECTION , in § 6.3
- SHOW_COMMENT , in § 6.3
- SHOW_DOCUMENT , in § 6.3
- SHOW_DOCUMENT_FRAGMENT , in § 6.3
- SHOW_DOCUMENT_TYPE , in § 6.3
- SHOW_ELEMENT , in § 6.3
- SHOW_ENTITY , in § 6.3
- SHOW_ENTITY_REFERENCE , in § 6.3
- SHOW_NOTATION , in § 6.3
- SHOW_PROCESSING_INSTRUCTION , in § 6.3
- SHOW_TEXT , in § 6.3
- sibling , in § 1.1
- signal
- attribute for AbortController , in § 3.1
- dfn for AbortController , in § 3.1
- dfn for event listener , in § 2.7
- dict-member for AddEventListenerOptions , in § 2.7
- signal abort
- dfn for AbortController , in § 3.1
- dfn for AbortSignal , in § 3.2
- signal a slot change , in § 4.2.2.5
- signal slots , in § 4.2.2.5
- singleNodeValue , in § 8.1
- slot
- attribute for Element , in § 4.9
- definition of , in § 4.2.2.1
- slot assignment , in § 4.8
- slotAssignment
- attribute for ShadowRoot , in § 4.8
- dict-member for ShadowRootInit , in § 4.9
- SlotAssignmentMode , in § 4.8
- slotchange , in § 4.3
- slot-in-closed-tree , in § 2.2
- Slottable , in § 4.2.9
- slottable , in § 4.2.2.2
- snapshotItem(index) , in § 8.1
- snapshotLength , in § 8.1
- source , in § 4.3
- source signals , in § 3.2
- specified , in § 4.9.2
- split a Text node , in § 4.11
- splitText(offset) , in § 4.11
- srcElement , in § 2.2
- start , in § 5.3
- startContainer
- attribute for AbstractRange , in § 5.3
- dict-member for StaticRangeInit , in § 5.4
- start node , in § 5.3
- start offset , in § 5.3
- startOffset
- attribute for AbstractRange , in § 5.3
- dict-member for StaticRangeInit , in § 5.4
- START_TO_END , in § 5.5
- START_TO_START , in § 5.5
- static collection , in § 4.2.10
- StaticRange , in § 5.4
- StaticRange(init) , in § 5.4
- StaticRangeInit , in § 5.4
- stopImmediatePropagation() , in § 2.2
- stop immediate propagation flag , in § 2.2
- stopPropagation() , in § 2.2
- stop propagation flag , in § 2.2
- strictErrorChecking , in § 11
- stringification behavior , in § 7.1
- stringificationbehavior , in § 5.5
- string replace all , in § 4.4
- STRING_TYPE , in § 8.1
- stringValue , in § 8.1
- substring data , in § 4.10
- substringData(offset, count) , in § 4.10
- subtree
- dfn for clone a node , in § 4.4
- dict-member for MutationObserverInit , in § 4.3.1
- supported tokens , in § 7.1
- supports(token) , in § 7.1
- suppressObservers
- dfn for insert , in § 4.2.3
- dfn for remove , in § 4.2.3
- surroundContents(newParent) , in § 5.5
- system ID , in § 4.6
- systemId , in § 4.6
- tagName , in § 4.9
- takeRecords() , in § 4.3.1
- target
- attribute for Event , in § 2.2
- attribute for MutationRecord , in § 4.3.3
- attribute for ProcessingInstruction , in § 4.13
- dfn for Event , in § 2.2
- dfn for ProcessingInstruction , in § 4.13
- Text , in § 4.11
- Text() , in § 4.11
- textContent , in § 4.4
- Text(data) , in § 4.11
- TEXT_NODE , in § 4.4
- throwIfAborted() , in § 3.2
- timeout(milliseconds) , in § 3.2
- timeStamp , in § 2.2
- toggleAttribute(name) , in § 4.13
- toggleAttribute(name, force) , in § 4.13
- toggleAttribute(qualifiedName) , in § 4.9
- toggleAttribute(qualifiedName, force) , in § 4.9
- toggle(token) , in § 7.1
- toggle(token, force) , in § 7.1
- token set , in § 7.1
- touch target list
- dfn for Event , in § 2.2
- dfn for event path item , in § 2.2
- transformToDocument(source) , in § 9.1
- transformToFragment(source, output) , in § 9.1
- transient registered observer , in § 4.3
- traverse , in § 6.1
- traverse children , in § 6.2
- traverse siblings , in § 6.2
- tree , in § 1.1
- tree order , in § 1.1
- TreeWalker , in § 6.2
- type
- attribute for Event , in § 2.2
- attribute for MutationRecord , in § 4.3.3
- dfn for Document , in § 4.5
- dfn for event listener , in § 2.7
- TypeInfo , in § 11
- UNORDERED_NODE_ITERATOR_TYPE , in § 8.1
- UNORDERED_NODE_SNAPSHOT_TYPE , in § 8.1
- update attributes from data , in § 4.13
- update data from attributes , in § 4.13
- update steps , in § 7.1
- URL
- attribute for Document , in § 4.5
- dfn for Document , in § 4.5
- UserDataHandler , in § 11
- valid , in § 5.4
- validate and extract , in § 1.4
- validation steps , in § 7.1
- valid attribute local name , in § 1.4
- valid doctype name , in § 1.4
- valid element local name , in § 1.4
- valid namespace prefix , in § 1.4
- valid shadow host name , in § 4.9
- value
- attribute for Attr , in § 4.9.2
- attribute for DOMTokenList , in § 7.1
- dfn for Attr , in § 4.9.2
- webkitMatchesSelector(selectors) , in § 4.9
- whatToShow
- attribute for NodeIterator , in § 6.1
- attribute for TreeWalker , in § 6.2
- dfn for traversal , in § 6
- wholeText , in § 4.11
- XML document , in § 4.5
- XMLDocument , in § 4.5
- xmlEncoding , in § 11
- xmlStandalone , in § 11
- xmlVersion , in § 11
- XPathEvaluator , in § 8.4
- XPathEvaluator() , in § 8.4
- XPathEvaluatorBase , in § 8.3
- XPathExpression , in § 8.2
- XPathNSResolver , in § 8.3
- XPathResult , in § 8.1
- XSLTProcessor , in § 9.1
- XSLTProcessor() , in § 9.1
### Terms defined by reference
- [] defines the following terms:
- DeviceMotionEvent
- DeviceOrientationEvent
- TouchEvent
- createContextualFragment()
- [CONSOLE] defines the following terms:
- report a warning to the console
- [CSSOM-VIEW] defines the following terms:
- getBoundingClientRect()
- getClientRects()
- [ECMASCRIPT] defines the following terms:
- current realm
- realm
- surrounding agent
- [ENCODING] defines the following terms:
- encoding
- name
- UTF-8
- [HR-TIME-3] defines the following terms:
- DOMHighResTimeStamp
- current high resolution time
- relative high resolution coarse time
- [HTML] defines the following terms:
- BeforeUnloadEvent
- CEReactions
- CustomElementRegistry
- DragEvent
- EventHandler
- HTMLAnchorElement
- HTMLElement
- HTMLHtmlElement
- HTMLSlotElement
- HTMLUnknownElement
- HashChangeEvent
- MessageEvent
- StorageEvent
- Window
- active custom element constructor map
- area
- associated Document
- browsing context
- browsing context (for Document)
- click()
- constructor
- current global object
- custom element constructor
- custom element definition
- customized built-in element
- disable shadow
- document base URL
- enqueue a custom element callback reaction
- enqueue a custom element upgrade reaction
- event handler
- event handler event type
- event handler IDL attribute
- global object
- head
- html
- HTML parser
- in parallel
- input
- is scoped
- local name
- look up a custom element definition
- look up a custom element registry
- manually assigned nodes
- microtask
- name
- opaque origin
- origin
- queue a global task
- queue a microtask
- relevant agent
- relevant global object
- relevant realm
- report an exception
- run steps after a timeout
- scoped document set
- script
- similar-origin window agent
- slot
- style
- template
- the body element
- timer task source
- title
- try to upgrade an element
- upgrade an element
- valid custom element name
- [INFRA] defines the following terms:
- append (for list)
- append (for set)
- ASCII alpha
- ASCII case-insensitive
- ASCII digit
- ASCII lowercase
- ASCII uppercase
- ASCII whitespace
- assert
- break
- clear
- clone
- code point
- code unit
- concatenation
- contain
- continue
- empty
- enqueue
- exist (for list)
- exist (for map)
- for each (for list)
- for each (for map)
- getting the keys
- HTML namespace
- identical to
- insert
- is empty (for list)
- is empty (for map)
- is not empty
- length
- list
- map
- ordered set
- prepend
- queue
- remove (for list)
- remove (for map)
- replace (for list)
- replace (for set)
- set
- set (for map)
- size
- split on ASCII whitespace
- string
- struct
- SVG namespace
- tuple
- with default
- XML namespace
- XMLNS namespace
- [LONG-ANIMATION-FRAMES] defines the following terms:
- record timing info for event listener
- [POINTEREVENTS3] defines the following terms:
- MouseEvent
- [SELECTORS4] defines the following terms:
- :defined
- match a selector against a tree
- match a selector against an element
- parse a selector
- scoping root
- [SERVICE-WORKERS] defines the following terms:
- ServiceWorkerGlobalScope
- has ever been evaluated flag
- script resource
- service worker
- service worker events
- set of event types to handle
- [TRUSTED-TYPES] defines the following terms:
- TrustedType
- get trusted type compliant attribute value
- [UIEVENTS] defines the following terms:
- CompositionEvent
- FocusEvent
- KeyboardEvent
- TextEvent
- UIEvent
- detail
- [URL] defines the following terms:
- URL
- URL serializer
- [WEBIDL] defines the following terms:
- AbortError
- DOMException
- DOMString
- EnforceRange
- Exposed
- HierarchyRequestError
- InUseAttributeError
- IndexSizeError
- InvalidCharacterError
- InvalidNodeTypeError
- InvalidStateError
- LegacyNullToEmptyString
- LegacyUnenumerableNamedProperties
- LegacyUnforgeable
- NamespaceError
- NewObject
- NotFoundError
- NotSupportedError
- PutForwards
- Replaceable
- SameObject
- SyntaxError
- TimeoutError
- USVString
- Unscopable
- WrongDocumentError
- a new promise
- any
- associated realm
- boolean
- call a user object's operation
- callback this value
- construct
- converted to an IDL value
- dictionary
- identifier
- implements
- invoke
- iterable
- new
- primary interface
- reject
- resolve
- sequence
- short
- supported property indices
- supported property names
- this
- throw
- undefined
- unrestricted double
- unsigned long
- unsigned long long
- unsigned short
- [XML] defines the following terms:
- Name
- [XML-STYLESHEET] defines the following terms:
- name
- parsing result
- pseudo-attribute
- rules for parsing pseudo-attributes from a string
- value
## References
### Normative References
[CONSOLE]
Dominic Farolino; Robert Kowalski; Terin Stock. [Console Standard](https://console.spec.whatwg.org/). Living Standard. URL: [https://console.spec.whatwg.org/](https://console.spec.whatwg.org/)
[DEVICE-ORIENTATION]
Reilly Grant; Marcos Caceres. [Device Orientation and Motion](https://w3c.github.io/deviceorientation/). URL: [https://w3c.github.io/deviceorientation/](https://w3c.github.io/deviceorientation/)
[ECMASCRIPT]
[ECMAScript Language Specification](https://tc39.es/ecma262/multipage/). URL: [https://tc39.es/ecma262/multipage/](https://tc39.es/ecma262/multipage/)
[ENCODING]
Anne van Kesteren. [Encoding Standard](https://encoding.spec.whatwg.org/). Living Standard. URL: [https://encoding.spec.whatwg.org/](https://encoding.spec.whatwg.org/)
[HR-TIME-3]
Yoav Weiss. [High Resolution Time](https://w3c.github.io/hr-time/). URL: [https://w3c.github.io/hr-time/](https://w3c.github.io/hr-time/)
[HTML]
Anne van Kesteren; et al. [HTML Standard](https://html.spec.whatwg.org/multipage/). Living Standard. URL: [https://html.spec.whatwg.org/multipage/](https://html.spec.whatwg.org/multipage/)
[INFRA]
Anne van Kesteren; Domenic Denicola. [Infra Standard](https://infra.spec.whatwg.org/). Living Standard. URL: [https://infra.spec.whatwg.org/](https://infra.spec.whatwg.org/)
[LONG-ANIMATION-FRAMES]
Noam Rosenthal. [Long Animation Frames API](https://w3c.github.io/long-animation-frames/). URL: [https://w3c.github.io/long-animation-frames/](https://w3c.github.io/long-animation-frames/)
[POINTEREVENTS3]
Patrick Lauke; Robert Flack. [Pointer Events](https://w3c.github.io/pointerevents/). URL: [https://w3c.github.io/pointerevents/](https://w3c.github.io/pointerevents/)
[SELECTORS4]
Elika Etemad; Tab Atkins Jr.. [Selectors Level 4](https://drafts.csswg.org/selectors/). URL: [https://drafts.csswg.org/selectors/](https://drafts.csswg.org/selectors/)
[SERVICE-WORKERS]
Monica CHINTALA; Yoshisato Yanagisawa. [Service Workers Nightly](https://w3c.github.io/ServiceWorker/). URL: [https://w3c.github.io/ServiceWorker/](https://w3c.github.io/ServiceWorker/)
[TOUCH-EVENTS]
Doug Schepers; et al. [Touch Events](https://w3c.github.io/touch-events/). URL: [https://w3c.github.io/touch-events/](https://w3c.github.io/touch-events/)
[TRUSTED-TYPES]
Krzysztof Kotowicz. [Trusted Types](https://w3c.github.io/trusted-types/dist/spec/). URL: [https://w3c.github.io/trusted-types/dist/spec/](https://w3c.github.io/trusted-types/dist/spec/)
[UIEVENTS]
Xiaoqian Wu. [UI Events](https://w3c.github.io/uievents/). URL: [https://w3c.github.io/uievents/](https://w3c.github.io/uievents/)
[URL]
Anne van Kesteren. [URL Standard](https://url.spec.whatwg.org/). Living Standard. URL: [https://url.spec.whatwg.org/](https://url.spec.whatwg.org/)
[WEBIDL]
Edgar Chen; Timothy Gu. [Web IDL Standard](https://webidl.spec.whatwg.org/). Living Standard. URL: [https://webidl.spec.whatwg.org/](https://webidl.spec.whatwg.org/)
[XML]
Tim Bray; et al. [Extensible Markup Language (XML) 1.0 (Fifth Edition)](https://www.w3.org/TR/xml/). 26 November 2008. REC. URL: [https://www.w3.org/TR/xml/](https://www.w3.org/TR/xml/)
[XML-NAMES]
Tim Bray; et al. [Namespaces in XML 1.0 (Third Edition)](https://www.w3.org/TR/xml-names/). 8 December 2009. REC. URL: [https://www.w3.org/TR/xml-names/](https://www.w3.org/TR/xml-names/)
[XML-STYLESHEET]
James Clark; Simon Pieters; Henry Thompson. [Associating Style Sheets with XML documents 1.0 (Second Edition)](https://www.w3.org/TR/xml-stylesheet/). 28 October 2010. REC. URL: [https://www.w3.org/TR/xml-stylesheet/](https://www.w3.org/TR/xml-stylesheet/)
### Non-Normative References
[CSSOM-VIEW]
Simon Fraser; Emilio Cobos Álvarez. [CSSOM View Module](https://drafts.csswg.org/cssom-view/). URL: [https://drafts.csswg.org/cssom-view/](https://drafts.csswg.org/cssom-view/)
[DOM-Level-3-XPath]
Ray Whitmer. [Document Object Model (DOM) Level 3 XPath Specification](https://www.w3.org/TR/DOM-Level-3-XPath/). 3 November 2020. NOTE. URL: [https://www.w3.org/TR/DOM-Level-3-XPath/](https://www.w3.org/TR/DOM-Level-3-XPath/)
[DOM-Parsing]
Travis Leithead. [DOM Parsing and Serialization](https://w3c.github.io/DOM-Parsing/). URL: [https://w3c.github.io/DOM-Parsing/](https://w3c.github.io/DOM-Parsing/)
[FULLSCREEN]
Philip Jägenstedt. [Fullscreen API Standard](https://fullscreen.spec.whatwg.org/). Living Standard. URL: [https://fullscreen.spec.whatwg.org/](https://fullscreen.spec.whatwg.org/)
[INDEXEDDB]
Nikunj Mehta; et al. [Indexed Database API](https://w3c.github.io/IndexedDB/). URL: [https://w3c.github.io/IndexedDB/](https://w3c.github.io/IndexedDB/)
[XPath]
James Clark; Steven DeRose. [XML Path Language (XPath) Version 1.0](https://www.w3.org/TR/xpath-10/). 16 November 1999. REC. URL: [https://www.w3.org/TR/xpath-10/](https://www.w3.org/TR/xpath-10/)
[XSLT]
James Clark. [XSL Transformations (XSLT) Version 1.0](https://www.w3.org/TR/xslt-10/). 16 November 1999. REC. URL: [https://www.w3.org/TR/xslt-10/](https://www.w3.org/TR/xslt-10/)
## IDL Index
```
[Exposed=*]
interface Event {
constructor(DOMString type, optional EventInit eventInitDict = {});
readonly attribute DOMString type;
readonly attribute EventTarget? target;
readonly attribute EventTarget? srcElement; // legacy
readonly attribute EventTarget? currentTarget;
sequence composedPath();
const unsigned short NONE = 0;
const unsigned short CAPTURING_PHASE = 1;
const unsigned short AT_TARGET = 2;
const unsigned short BUBBLING_PHASE = 3;
readonly attribute unsigned short eventPhase;
undefined stopPropagation();
attribute boolean cancelBubble; // legacy alias of .stopPropagation()
undefined stopImmediatePropagation();
readonly attribute boolean bubbles;
readonly attribute boolean cancelable;
attribute boolean returnValue; // legacy
undefined preventDefault();
readonly attribute boolean defaultPrevented;
readonly attribute boolean composed;
[LegacyUnforgeable] readonly attribute boolean isTrusted;
readonly attribute DOMHighResTimeStamp timeStamp;
undefined initEvent(DOMString type, optional boolean bubbles = false, optional boolean cancelable = false); // legacy
};
dictionary EventInit {
boolean bubbles = false;
boolean cancelable = false;
boolean composed = false;
};
partial interface Window {
[Replaceable] readonly attribute (Event or undefined) event; // legacy
};
[Exposed=*]
interface CustomEvent : Event {
constructor(DOMString type, optional CustomEventInit eventInitDict = {});
readonly attribute any detail;
undefined initCustomEvent(DOMString type, optional boolean bubbles = false, optional boolean cancelable = false, optional any detail = null); // legacy
};
dictionary CustomEventInit : EventInit {
any detail = null;
};
[Exposed=*]
interface EventTarget {
constructor();
undefined addEventListener(DOMString type, EventListener? callback, optional (AddEventListenerOptions or boolean) options = {});
undefined removeEventListener(DOMString type, EventListener? callback, optional (EventListenerOptions or boolean) options = {});
boolean dispatchEvent(Event event);
};
callback interface EventListener {
undefined handleEvent(Event event);
};
dictionary EventListenerOptions {
boolean capture = false;
};
dictionary AddEventListenerOptions : EventListenerOptions {
boolean passive;
boolean once = false;
AbortSignal signal;
};
[Exposed=*]
interface AbortController {
constructor();
[SameObject] readonly attribute AbortSignal signal;
undefined abort(optional any reason);
};
[Exposed=*]
interface AbortSignal : EventTarget {
[NewObject] static AbortSignal abort(optional any reason);
[Exposed=(Window,Worker), NewObject] static AbortSignal timeout([EnforceRange] unsigned long long milliseconds);
[NewObject] static AbortSignal _any(sequence signals);
readonly attribute boolean aborted;
readonly attribute any reason;
undefined throwIfAborted();
attribute EventHandler onabort;
};
interface mixin NonElementParentNode {
Element? getElementById(DOMString elementId);
};
Document includes NonElementParentNode;
DocumentFragment includes NonElementParentNode;
interface mixin DocumentOrShadowRoot {
readonly attribute CustomElementRegistry? customElementRegistry;
};
Document includes DocumentOrShadowRoot;
ShadowRoot includes DocumentOrShadowRoot;
interface mixin ParentNode {
[SameObject] readonly attribute HTMLCollection children;
readonly attribute Element? firstElementChild;
readonly attribute Element? lastElementChild;
readonly attribute unsigned long childElementCount;
[CEReactions, Unscopable] undefined prepend((Node or DOMString)... nodes);
[CEReactions, Unscopable] undefined append((Node or DOMString)... nodes);
[CEReactions, Unscopable] undefined replaceChildren((Node or DOMString)... nodes);
[CEReactions] undefined moveBefore(Node node, Node? child);
Element? querySelector(DOMString selectors);
[NewObject] NodeList querySelectorAll(DOMString selectors);
};
Document includes ParentNode;
DocumentFragment includes ParentNode;
Element includes ParentNode;
interface mixin NonDocumentTypeChildNode {
readonly attribute Element? previousElementSibling;
readonly attribute Element? nextElementSibling;
};
Element includes NonDocumentTypeChildNode;
CharacterData includes NonDocumentTypeChildNode;
interface mixin ChildNode {
[CEReactions, Unscopable] undefined before((Node or DOMString)... nodes);
[CEReactions, Unscopable] undefined after((Node or DOMString)... nodes);
[CEReactions, Unscopable] undefined replaceWith((Node or DOMString)... nodes);
[CEReactions, Unscopable] undefined remove();
};
DocumentType includes ChildNode;
Element includes ChildNode;
CharacterData includes ChildNode;
interface mixin Slottable {
readonly attribute HTMLSlotElement? assignedSlot;
};
Element includes Slottable;
Text includes Slottable;
[Exposed=Window]
interface NodeList {
getter Node? item(unsigned long index);
readonly attribute unsigned long length;
iterable;
};
[Exposed=Window, LegacyUnenumerableNamedProperties]
interface HTMLCollection {
readonly attribute unsigned long length;
getter Element? item(unsigned long index);
getter Element? namedItem(DOMString name);
};
[Exposed=Window]
interface MutationObserver {
constructor(MutationCallback callback);
undefined observe(Node target, optional MutationObserverInit options = {});
undefined disconnect();
sequence takeRecords();
};
callback MutationCallback = undefined (sequence mutations, MutationObserver observer);
dictionary MutationObserverInit {
boolean childList = false;
boolean attributes;
boolean characterData;
boolean subtree = false;
boolean attributeOldValue;
boolean characterDataOldValue;
sequence attributeFilter;
};
[Exposed=Window]
interface MutationRecord {
readonly attribute DOMString type;
[SameObject] readonly attribute Node target;
[SameObject] readonly attribute NodeList addedNodes;
[SameObject] readonly attribute NodeList removedNodes;
readonly attribute Node? previousSibling;
readonly attribute Node? nextSibling;
readonly attribute DOMString? attributeName;
readonly attribute DOMString? attributeNamespace;
readonly attribute DOMString? oldValue;
};
[Exposed=Window]
interface Node : EventTarget {
const unsigned short ELEMENT_NODE = 1;
const unsigned short ATTRIBUTE_NODE = 2;
const unsigned short TEXT_NODE = 3;
const unsigned short CDATA_SECTION_NODE = 4;
const unsigned short ENTITY_REFERENCE_NODE = 5; // legacy
const unsigned short ENTITY_NODE = 6; // legacy
const unsigned short PROCESSING_INSTRUCTION_NODE = 7;
const unsigned short COMMENT_NODE = 8;
const unsigned short DOCUMENT_NODE = 9;
const unsigned short DOCUMENT_TYPE_NODE = 10;
const unsigned short DOCUMENT_FRAGMENT_NODE = 11;
const unsigned short NOTATION_NODE = 12; // legacy
readonly attribute unsigned short nodeType;
readonly attribute DOMString nodeName;
readonly attribute USVString baseURI;
readonly attribute boolean isConnected;
readonly attribute Document? ownerDocument;
Node getRootNode(optional GetRootNodeOptions options = {});
readonly attribute Node? parentNode;
readonly attribute Element? parentElement;
boolean hasChildNodes();
[SameObject] readonly attribute NodeList childNodes;
readonly attribute Node? firstChild;
readonly attribute Node? lastChild;
readonly attribute Node? previousSibling;
readonly attribute Node? nextSibling;
[CEReactions] attribute DOMString? nodeValue;
[CEReactions] attribute DOMString? textContent;
[CEReactions] undefined normalize();
[CEReactions, NewObject] Node cloneNode(optional boolean subtree = false);
boolean isEqualNode(Node? otherNode);
boolean isSameNode(Node? otherNode); // legacy alias of ===
const unsigned short DOCUMENT_POSITION_DISCONNECTED = 0x01;
const unsigned short DOCUMENT_POSITION_PRECEDING = 0x02;
const unsigned short DOCUMENT_POSITION_FOLLOWING = 0x04;
const unsigned short DOCUMENT_POSITION_CONTAINS = 0x08;
const unsigned short DOCUMENT_POSITION_CONTAINED_BY = 0x10;
const unsigned short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20;
unsigned short compareDocumentPosition(Node other);
boolean contains(Node? other);
DOMString? lookupPrefix(DOMString? namespace);
DOMString? lookupNamespaceURI(DOMString? prefix);
boolean isDefaultNamespace(DOMString? namespace);
[CEReactions] Node insertBefore(Node node, Node? child);
[CEReactions] Node appendChild(Node node);
[CEReactions] Node replaceChild(Node node, Node child);
[CEReactions] Node removeChild(Node child);
};
dictionary GetRootNodeOptions {
boolean composed = false;
};
[Exposed=Window]
interface Document : Node {
constructor();
[SameObject] readonly attribute DOMImplementation implementation;
readonly attribute USVString URL;
readonly attribute USVString documentURI;
readonly attribute DOMString compatMode;
readonly attribute DOMString characterSet;
readonly attribute DOMString charset; // legacy alias of .characterSet
readonly attribute DOMString inputEncoding; // legacy alias of .characterSet
readonly attribute DOMString contentType;
readonly attribute DocumentType? doctype;
readonly attribute Element? documentElement;
HTMLCollection getElementsByTagName(DOMString qualifiedName);
HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
HTMLCollection getElementsByClassName(DOMString classNames);
[CEReactions, NewObject] Element createElement(DOMString localName, optional (DOMString or ElementCreationOptions) options = {});
[CEReactions, NewObject] Element createElementNS(DOMString? namespace, DOMString qualifiedName, optional (DOMString or ElementCreationOptions) options = {});
[NewObject] DocumentFragment createDocumentFragment();
[NewObject] Text createTextNode(DOMString data);
[NewObject] CDATASection createCDATASection(DOMString data);
[NewObject] Comment createComment(DOMString data);
[NewObject] ProcessingInstruction createProcessingInstruction(DOMString target, DOMString data);
[CEReactions, NewObject] Node importNode(Node node, optional (boolean or ImportNodeOptions) options = false);
[CEReactions] Node adoptNode(Node node);
[NewObject] Attr createAttribute(DOMString localName);
[NewObject] Attr createAttributeNS(DOMString? namespace, DOMString qualifiedName);
[NewObject] Event createEvent(DOMString interface); // legacy
[NewObject] Range createRange();
// NodeFilter.SHOW_ALL = 0xFFFFFFFF
[NewObject] NodeIterator createNodeIterator(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null);
[NewObject] TreeWalker createTreeWalker(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null);
};
[Exposed=Window]
interface XMLDocument : Document {};
dictionary ElementCreationOptions {
CustomElementRegistry? customElementRegistry;
DOMString is;
};
dictionary ImportNodeOptions {
CustomElementRegistry customElementRegistry;
boolean selfOnly = false;
};
[Exposed=Window]
interface DOMImplementation {
[NewObject] DocumentType createDocumentType(DOMString name, DOMString publicId, DOMString systemId);
[NewObject] XMLDocument createDocument(DOMString? namespace, [LegacyNullToEmptyString] DOMString qualifiedName, optional DocumentType? doctype = null);
[NewObject] Document createHTMLDocument(optional DOMString title);
boolean hasFeature(); // historical; always returns true
};
[Exposed=Window]
interface DocumentType : Node {
readonly attribute DOMString name;
readonly attribute DOMString publicId;
readonly attribute DOMString systemId;
};
[Exposed=Window]
interface DocumentFragment : Node {
constructor();
};
[Exposed=Window]
interface ShadowRoot : DocumentFragment {
readonly attribute ShadowRootMode mode;
readonly attribute boolean delegatesFocus;
readonly attribute boolean serializable;
readonly attribute SlotAssignmentMode slotAssignment;
readonly attribute boolean clonable;
readonly attribute Element host;
attribute EventHandler onslotchange;
};
enum ShadowRootMode { "open", "closed" };
enum SlotAssignmentMode { "manual", "named" };
[Exposed=Window]
interface Element : Node {
readonly attribute DOMString? namespaceURI;
readonly attribute DOMString? prefix;
readonly attribute DOMString localName;
readonly attribute DOMString tagName;
[CEReactions] attribute DOMString id;
[CEReactions] attribute DOMString className;
[SameObject, PutForwards=value] readonly attribute DOMTokenList classList;
[CEReactions, Unscopable] attribute DOMString slot;
boolean hasAttributes();
[SameObject] readonly attribute NamedNodeMap attributes;
sequence getAttributeNames();
DOMString? getAttribute(DOMString qualifiedName);
DOMString? getAttributeNS(DOMString? namespace, DOMString localName);
[CEReactions] undefined setAttribute(DOMString qualifiedName, (TrustedType or DOMString) value);
[CEReactions] undefined setAttributeNS(DOMString? namespace, DOMString qualifiedName, (TrustedType or DOMString) value);
[CEReactions] undefined removeAttribute(DOMString qualifiedName);
[CEReactions] undefined removeAttributeNS(DOMString? namespace, DOMString localName);
[CEReactions] boolean toggleAttribute(DOMString qualifiedName, optional boolean force);
boolean hasAttribute(DOMString qualifiedName);
boolean hasAttributeNS(DOMString? namespace, DOMString localName);
Attr? getAttributeNode(DOMString qualifiedName);
Attr? getAttributeNodeNS(DOMString? namespace, DOMString localName);
[CEReactions] Attr? setAttributeNode(Attr attr);
[CEReactions] Attr? setAttributeNodeNS(Attr attr);
[CEReactions] Attr removeAttributeNode(Attr attr);
ShadowRoot attachShadow(ShadowRootInit init);
readonly attribute ShadowRoot? shadowRoot;
readonly attribute CustomElementRegistry? customElementRegistry;
Element? closest(DOMString selectors);
boolean matches(DOMString selectors);
boolean webkitMatchesSelector(DOMString selectors); // legacy alias of .matches
HTMLCollection getElementsByTagName(DOMString qualifiedName);
HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
HTMLCollection getElementsByClassName(DOMString classNames);
[CEReactions] Element? insertAdjacentElement(DOMString where, Element element); // legacy
undefined insertAdjacentText(DOMString where, DOMString data); // legacy
};
dictionary ShadowRootInit {
required ShadowRootMode mode;
boolean delegatesFocus = false;
boolean serializable = false;
SlotAssignmentMode slotAssignment = "named";
boolean clonable = false;
CustomElementRegistry? customElementRegistry;
};
[Exposed=Window,
LegacyUnenumerableNamedProperties]
interface NamedNodeMap {
readonly attribute unsigned long length;
getter Attr? item(unsigned long index);
getter Attr? getNamedItem(DOMString qualifiedName);
Attr? getNamedItemNS(DOMString? namespace, DOMString localName);
[CEReactions] Attr? setNamedItem(Attr attr);
[CEReactions] Attr? setNamedItemNS(Attr attr);
[CEReactions] Attr removeNamedItem(DOMString qualifiedName);
[CEReactions] Attr removeNamedItemNS(DOMString? namespace, DOMString localName);
};
[Exposed=Window]
interface Attr : Node {
readonly attribute DOMString? namespaceURI;
readonly attribute DOMString? prefix;
readonly attribute DOMString localName;
readonly attribute DOMString name;
[CEReactions] attribute DOMString value;
readonly attribute Element? ownerElement;
readonly attribute boolean specified; // historical; always returns true
};
[Exposed=Window]
interface CharacterData : Node {
attribute [LegacyNullToEmptyString] DOMString data;
readonly attribute unsigned long length;
DOMString substringData(unsigned long offset, unsigned long count);
undefined appendData(DOMString data);
undefined insertData(unsigned long offset, DOMString data);
undefined deleteData(unsigned long offset, unsigned long count);
undefined replaceData(unsigned long offset, unsigned long count, DOMString data);
};
[Exposed=Window]
interface Text : CharacterData {
constructor(optional DOMString data = "");
[NewObject] Text splitText(unsigned long offset);
readonly attribute DOMString wholeText;
};
[Exposed=Window]
interface CDATASection : Text {
};
[Exposed=Window]
interface ProcessingInstruction : CharacterData {
constructor(DOMString target, optional DOMString data = "");
readonly attribute DOMString target;
boolean hasAttributes();
sequence getAttributeNames();
DOMString? getAttribute(DOMString name);
undefined setAttribute(DOMString name, DOMString value);
undefined removeAttribute(DOMString name);
boolean toggleAttribute(DOMString name, optional boolean force);
boolean hasAttribute(DOMString name);
};
[Exposed=Window]
interface Comment : CharacterData {
constructor(optional DOMString data = "");
};
[Exposed=Window]
interface AbstractRange {
readonly attribute Node startContainer;
readonly attribute unsigned long startOffset;
readonly attribute Node endContainer;
readonly attribute unsigned long endOffset;
readonly attribute boolean collapsed;
};
dictionary StaticRangeInit {
required Node startContainer;
required unsigned long startOffset;
required Node endContainer;
required unsigned long endOffset;
};
[Exposed=Window]
interface StaticRange : AbstractRange {
constructor(StaticRangeInit init);
};
[Exposed=Window]
interface Range : AbstractRange {
constructor();
readonly attribute Node commonAncestorContainer;
undefined setStart(Node node, unsigned long offset);
undefined setEnd(Node node, unsigned long offset);
undefined setStartBefore(Node node);
undefined setStartAfter(Node node);
undefined setEndBefore(Node node);
undefined setEndAfter(Node node);
undefined collapse(optional boolean toStart = false);
undefined selectNode(Node node);
undefined selectNodeContents(Node node);
const unsigned short START_TO_START = 0;
const unsigned short START_TO_END = 1;
const unsigned short END_TO_END = 2;
const unsigned short END_TO_START = 3;
short compareBoundaryPoints(unsigned short how, Range sourceRange);
[CEReactions] undefined deleteContents();
[CEReactions, NewObject] DocumentFragment extractContents();
[CEReactions, NewObject] DocumentFragment cloneContents();
[CEReactions] undefined insertNode(Node node);
[CEReactions] undefined surroundContents(Node newParent);
[NewObject] Range cloneRange();
undefined detach();
boolean isPointInRange(Node node, unsigned long offset);
short comparePoint(Node node, unsigned long offset);
boolean intersectsNode(Node node);
stringifier;
};
[Exposed=Window]
interface NodeIterator {
[SameObject] readonly attribute Node root;
readonly attribute Node referenceNode;
readonly attribute boolean pointerBeforeReferenceNode;
readonly attribute unsigned long whatToShow;
readonly attribute NodeFilter? filter;
Node? nextNode();
Node? previousNode();
undefined detach();
};
[Exposed=Window]
interface TreeWalker {
[SameObject] readonly attribute Node root;
readonly attribute unsigned long whatToShow;
readonly attribute NodeFilter? filter;
attribute Node currentNode;
Node? parentNode();
Node? firstChild();
Node? lastChild();
Node? previousSibling();
Node? nextSibling();
Node? previousNode();
Node? nextNode();
};
[Exposed=Window]
callback interface NodeFilter {
// Constants for acceptNode()
const unsigned short FILTER_ACCEPT = 1;
const unsigned short FILTER_REJECT = 2;
const unsigned short FILTER_SKIP = 3;
// Constants for whatToShow
const unsigned long SHOW_ALL = 0xFFFFFFFF;
const unsigned long SHOW_ELEMENT = 0x1;
const unsigned long SHOW_ATTRIBUTE = 0x2;
const unsigned long SHOW_TEXT = 0x4;
const unsigned long SHOW_CDATA_SECTION = 0x8;
const unsigned long SHOW_ENTITY_REFERENCE = 0x10; // legacy
const unsigned long SHOW_ENTITY = 0x20; // legacy
const unsigned long SHOW_PROCESSING_INSTRUCTION = 0x40;
const unsigned long SHOW_COMMENT = 0x80;
const unsigned long SHOW_DOCUMENT = 0x100;
const unsigned long SHOW_DOCUMENT_TYPE = 0x200;
const unsigned long SHOW_DOCUMENT_FRAGMENT = 0x400;
const unsigned long SHOW_NOTATION = 0x800; // legacy
unsigned short acceptNode(Node node);
};
[Exposed=Window]
interface DOMTokenList {
readonly attribute unsigned long length;
getter DOMString? item(unsigned long index);
boolean contains(DOMString token);
[CEReactions] undefined add(DOMString... tokens);
[CEReactions] undefined remove(DOMString... tokens);
[CEReactions] boolean toggle(DOMString token, optional boolean force);
[CEReactions] boolean replace(DOMString token, DOMString newToken);
boolean supports(DOMString token);
[CEReactions] stringifier attribute DOMString value;
iterable;
};
[Exposed=Window]
interface XPathResult {
const unsigned short ANY_TYPE = 0;
const unsigned short NUMBER_TYPE = 1;
const unsigned short STRING_TYPE = 2;
const unsigned short BOOLEAN_TYPE = 3;
const unsigned short UNORDERED_NODE_ITERATOR_TYPE = 4;
const unsigned short ORDERED_NODE_ITERATOR_TYPE = 5;
const unsigned short UNORDERED_NODE_SNAPSHOT_TYPE = 6;
const unsigned short ORDERED_NODE_SNAPSHOT_TYPE = 7;
const unsigned short ANY_UNORDERED_NODE_TYPE = 8;
const unsigned short FIRST_ORDERED_NODE_TYPE = 9;
readonly attribute unsigned short resultType;
readonly attribute unrestricted double numberValue;
readonly attribute DOMString stringValue;
readonly attribute boolean booleanValue;
readonly attribute Node? singleNodeValue;
readonly attribute boolean invalidIteratorState;
readonly attribute unsigned long snapshotLength;
Node? iterateNext();
Node? snapshotItem(unsigned long index);
};
[Exposed=Window]
interface XPathExpression {
// XPathResult.ANY_TYPE = 0
XPathResult evaluate(Node contextNode, optional unsigned short type = 0, optional XPathResult? result = null);
};
callback interface XPathNSResolver {
DOMString? lookupNamespaceURI(DOMString? prefix);
};
interface mixin XPathEvaluatorBase {
[NewObject] XPathExpression createExpression(DOMString expression, optional XPathNSResolver? resolver = null);
Node createNSResolver(Node nodeResolver); // legacy
// XPathResult.ANY_TYPE = 0
XPathResult evaluate(DOMString expression, Node contextNode, optional XPathNSResolver? resolver = null, optional unsigned short type = 0, optional XPathResult? result = null);
};
Document includes XPathEvaluatorBase;
[Exposed=Window]
interface XPathEvaluator {
constructor();
};
XPathEvaluator includes XPathEvaluatorBase;
[Exposed=Window]
interface XSLTProcessor {
constructor();
undefined importStylesheet(Node style);
[CEReactions] DocumentFragment transformToFragment(Node source, Document output);
[CEReactions] Document transformToDocument(Node source);
undefined setParameter([LegacyNullToEmptyString] DOMString namespaceURI, DOMString localName, any value);
any getParameter([LegacyNullToEmptyString] DOMString namespaceURI, DOMString localName);
undefined removeParameter([LegacyNullToEmptyString] DOMString namespaceURI, DOMString localName);
undefined clearParameters();
undefined reset();
};
```
**✔**MDN [AbortController/AbortController](https://developer.mozilla.org/en-US/docs/Web/API/AbortController/AbortController) In all current engines. Firefox57+Safari12.1+Chrome66+ Opera?Edge79+ Edge (Legacy)16+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? Node.js15.0.0+ [AbortController/abort](https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort) In all current engines. Firefox57+Safari12.1+Chrome66+ Opera?Edge79+ Edge (Legacy)16+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? Node.js15.0.0+ **✔**MDN [AbortController/signal](https://developer.mozilla.org/en-US/docs/Web/API/AbortController/signal) In all current engines. Firefox57+Safari12.1+Chrome66+ Opera?Edge79+ Edge (Legacy)16+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? Node.js15.0.0+ **✔**MDN [AbortController](https://developer.mozilla.org/en-US/docs/Web/API/AbortController) In all current engines. Firefox57+Safari12.1+Chrome66+ Opera?Edge79+ Edge (Legacy)16+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? Node.js15.0.0+ **✔**MDN [AbortSignal/abort_event](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/abort_event) In all current engines. Firefox57+Safari11.1+Chrome66+ Opera?Edge79+ Edge (Legacy)16+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? Node.js15.0.0+ **✔**MDN [AbortSignal/abort_event](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/abort_event) In all current engines. Firefox57+Safari11.1+Chrome66+ Opera?Edge79+ Edge (Legacy)16+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? Node.js15.0.0+ **✔**MDN [AbortSignal/abort_static](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/abort_static) In all current engines. Firefox88+Safari15+Chrome93+ Opera?Edge93+ Edge (Legacy)?IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? Node.js15.12.0+ **✔**MDN [AbortSignal/aborted](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/aborted) In all current engines. Firefox57+Safari11.1+Chrome66+ Opera?Edge79+ Edge (Legacy)16+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? Node.js15.0.0+ **✔**MDN [AbortSignal/reason](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/reason) In all current engines. Firefox97+Safari15.4+Chrome98+ Opera?Edge98+ Edge (Legacy)?IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? Node.js17.2.0+ **✔**MDN [AbortSignal/throwIfAborted](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/throwIfAborted) In all current engines. Firefox97+Safari15.4+Chrome100+ Opera?Edge100+ Edge (Legacy)?IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? Node.js17.3.0+ **✔**MDN [AbortSignal/timeout_static](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/timeout_static) In all current engines. Firefox100+Safari16+Chrome103+ Opera?Edge103+ Edge (Legacy)?IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? Node.js17.3.0+ **✔**MDN [AbortSignal](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) In all current engines. Firefox57+Safari11.1+Chrome66+ Opera?Edge79+ Edge (Legacy)16+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? Node.js15.0.0+ **✔**MDN [AbstractRange/collapsed](https://developer.mozilla.org/en-US/docs/Web/API/AbstractRange/collapsed) In all current engines. Firefox69+Safari14.1+Chrome90+ Opera?Edge90+ Edge (Legacy)NoneIENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? [Range/collapsed](https://developer.mozilla.org/en-US/docs/Web/API/Range/collapsed) In all current engines. Firefox1+Safari1+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ [StaticRange/collapsed](https://developer.mozilla.org/en-US/docs/Web/API/StaticRange/collapsed) In all current engines. Firefox69+Safari10.1+Chrome60+ Opera?Edge79+ Edge (Legacy)18IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [AbstractRange/endContainer](https://developer.mozilla.org/en-US/docs/Web/API/AbstractRange/endContainer) In all current engines. Firefox69+Safari14.1+Chrome90+ Opera?Edge90+ Edge (Legacy)NoneIENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? [Range/endContainer](https://developer.mozilla.org/en-US/docs/Web/API/Range/endContainer) In all current engines. Firefox1+Safari1+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ [StaticRange/endContainer](https://developer.mozilla.org/en-US/docs/Web/API/StaticRange/endContainer) In all current engines. Firefox69+Safari10.1+Chrome60+ Opera?Edge79+ Edge (Legacy)18IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [AbstractRange/endOffset](https://developer.mozilla.org/en-US/docs/Web/API/AbstractRange/endOffset) In all current engines. Firefox69+Safari14.1+Chrome90+ Opera?Edge90+ Edge (Legacy)NoneIENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? [Range/endOffset](https://developer.mozilla.org/en-US/docs/Web/API/Range/endOffset) In all current engines. Firefox1+Safari1+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ [StaticRange/endOffset](https://developer.mozilla.org/en-US/docs/Web/API/StaticRange/endOffset) In all current engines. Firefox69+Safari10.1+Chrome60+ Opera?Edge79+ Edge (Legacy)18IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [AbstractRange/startContainer](https://developer.mozilla.org/en-US/docs/Web/API/AbstractRange/startContainer) In all current engines. Firefox69+Safari14.1+Chrome90+ Opera?Edge90+ Edge (Legacy)NoneIENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? [Range/startContainer](https://developer.mozilla.org/en-US/docs/Web/API/Range/startContainer) In all current engines. Firefox1+Safari1+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ [StaticRange/startContainer](https://developer.mozilla.org/en-US/docs/Web/API/StaticRange/startContainer) In all current engines. Firefox69+Safari10.1+Chrome60+ Opera?Edge79+ Edge (Legacy)18IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [AbstractRange/startOffset](https://developer.mozilla.org/en-US/docs/Web/API/AbstractRange/startOffset) In all current engines. Firefox69+Safari14.1+Chrome90+ Opera?Edge90+ Edge (Legacy)NoneIENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? [Range/startOffset](https://developer.mozilla.org/en-US/docs/Web/API/Range/startOffset) In all current engines. Firefox1+Safari1+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ [StaticRange/startOffset](https://developer.mozilla.org/en-US/docs/Web/API/StaticRange/startOffset) In all current engines. Firefox69+Safari10.1+Chrome60+ Opera?Edge79+ Edge (Legacy)18IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [AbstractRange](https://developer.mozilla.org/en-US/docs/Web/API/AbstractRange) In all current engines. Firefox69+Safari14.1+Chrome90+ Opera?Edge90+ Edge (Legacy)NoneIENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [Attr/localName](https://developer.mozilla.org/en-US/docs/Web/API/Attr/localName) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Attr/name](https://developer.mozilla.org/en-US/docs/Web/API/Attr/name) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE6+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Attr/namespaceURI](https://developer.mozilla.org/en-US/docs/Web/API/Attr/namespaceURI) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Attr/ownerElement](https://developer.mozilla.org/en-US/docs/Web/API/Attr/ownerElement) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE8+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Attr/prefix](https://developer.mozilla.org/en-US/docs/Web/API/Attr/prefix) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Attr/value](https://developer.mozilla.org/en-US/docs/Web/API/Attr/value) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE6+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Attr](https://developer.mozilla.org/en-US/docs/Web/API/Attr) In all current engines. Firefox1+Safari1+Chrome1+ Opera8+Edge79+ Edge (Legacy)12+IE5.5+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [CDATASection](https://developer.mozilla.org/en-US/docs/Web/API/CDATASection) In all current engines. Firefox1+Safari3+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari1+Chrome for Android?Android WebView37+Samsung Internet?Opera Mobile12.1+ **✔**MDN [CharacterData/after](https://developer.mozilla.org/en-US/docs/Web/API/CharacterData/after) In all current engines. Firefox49+Safari10+Chrome54+ Opera39+Edge79+ Edge (Legacy)17+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? [DocumentType/after](https://developer.mozilla.org/en-US/docs/Web/API/DocumentType/after) In all current engines. Firefox49+Safari10+Chrome54+ Opera39+Edge79+ Edge (Legacy)17+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? [Element/after](https://developer.mozilla.org/en-US/docs/Web/API/Element/after) In all current engines. Firefox49+Safari10+Chrome54+ Opera39+Edge79+ Edge (Legacy)17+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [CharacterData/appendData](https://developer.mozilla.org/en-US/docs/Web/API/CharacterData/appendData) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE6+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [CharacterData/before](https://developer.mozilla.org/en-US/docs/Web/API/CharacterData/before) In all current engines. Firefox49+Safari10+Chrome54+ Opera39+Edge79+ Edge (Legacy)17+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? [DocumentType/before](https://developer.mozilla.org/en-US/docs/Web/API/DocumentType/before) In all current engines. Firefox49+Safari10+Chrome54+ Opera39+Edge79+ Edge (Legacy)17+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? [Element/before](https://developer.mozilla.org/en-US/docs/Web/API/Element/before) In all current engines. Firefox49+Safari10+Chrome54+ Opera39+Edge79+ Edge (Legacy)17+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [CharacterData/data](https://developer.mozilla.org/en-US/docs/Web/API/CharacterData/data) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE5+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [CharacterData/deleteData](https://developer.mozilla.org/en-US/docs/Web/API/CharacterData/deleteData) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE6+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [CharacterData/insertData](https://developer.mozilla.org/en-US/docs/Web/API/CharacterData/insertData) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE6+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [CharacterData/length](https://developer.mozilla.org/en-US/docs/Web/API/CharacterData/length) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE5+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [CharacterData/nextElementSibling](https://developer.mozilla.org/en-US/docs/Web/API/CharacterData/nextElementSibling) In all current engines. Firefox25+Safari9+Chrome29+ Opera?Edge79+ Edge (Legacy)17+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? [Element/nextElementSibling](https://developer.mozilla.org/en-US/docs/Web/API/Element/nextElementSibling) In all current engines. Firefox3.5+Safari4+Chrome2+ Opera10+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari3+Chrome for Android?Android WebView37+Samsung Internet?Opera Mobile10.1+ **✔**MDN [CharacterData/previousElementSibling](https://developer.mozilla.org/en-US/docs/Web/API/CharacterData/previousElementSibling) In all current engines. Firefox25+Safari9+Chrome29+ Opera?Edge79+ Edge (Legacy)17+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? [Element/previousElementSibling](https://developer.mozilla.org/en-US/docs/Web/API/Element/previousElementSibling) In all current engines. Firefox3.5+Safari4+Chrome2+ Opera10+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari3+Chrome for Android?Android WebView37+Samsung Internet?Opera Mobile10.1+ **✔**MDN [CharacterData/remove](https://developer.mozilla.org/en-US/docs/Web/API/CharacterData/remove) In all current engines. Firefox23+Safari7+Chrome24+ Opera?Edge79+ Edge (Legacy)12+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? [DocumentType/remove](https://developer.mozilla.org/en-US/docs/Web/API/DocumentType/remove) In all current engines. Firefox23+Safari7+Chrome24+ Opera?Edge79+ Edge (Legacy)12+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? [Element/remove](https://developer.mozilla.org/en-US/docs/Web/API/Element/remove) In all current engines. Firefox23+Safari7+Chrome24+ Opera?Edge79+ Edge (Legacy)12+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [CharacterData/replaceData](https://developer.mozilla.org/en-US/docs/Web/API/CharacterData/replaceData) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE6+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [CharacterData/replaceWith](https://developer.mozilla.org/en-US/docs/Web/API/CharacterData/replaceWith) In all current engines. Firefox49+Safari10+Chrome54+ Opera39+Edge79+ Edge (Legacy)17+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? [DocumentType/replaceWith](https://developer.mozilla.org/en-US/docs/Web/API/DocumentType/replaceWith) In all current engines. Firefox49+Safari10+Chrome54+ Opera39+Edge79+ Edge (Legacy)17+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? [Element/replaceWith](https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceWith) In all current engines. Firefox49+Safari10+Chrome54+ Opera39+Edge79+ Edge (Legacy)17+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [CharacterData/substringData](https://developer.mozilla.org/en-US/docs/Web/API/CharacterData/substringData) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE6+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [CharacterData](https://developer.mozilla.org/en-US/docs/Web/API/CharacterData) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE5+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Comment/Comment](https://developer.mozilla.org/en-US/docs/Web/API/Comment/Comment) In all current engines. Firefox24+Safari8+Chrome29+ Opera?Edge79+ Edge (Legacy)16+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [Comment](https://developer.mozilla.org/en-US/docs/Web/API/Comment) In all current engines. Firefox1+Safari3+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari1+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [CustomEvent/CustomEvent](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent) In all current engines. Firefox11+Safari6+Chrome15+ Opera11.6+Edge79+ Edge (Legacy)12+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12+ **✔**MDN [CustomEvent/detail](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/detail) In all current engines. Firefox6+Safari5+Chrome5+ Opera11.6+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari5+Chrome for Android?Android WebView3+Samsung Internet?Opera Mobile12+ **✔**MDN [CustomEvent](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent) In all current engines. Firefox6+Safari5+Chrome5+ Opera11+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari5+Chrome for Android?Android WebView3+Samsung Internet?Opera Mobile11+ Node.js19.0.0+ **✔**MDN [DOMImplementation/createDocument](https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocument) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [DOMImplementation/createDocumentType](https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocumentType) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [DOMImplementation/createHTMLDocument](https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument) In all current engines. Firefox4+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [DOMImplementation](https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE6+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [DOMTokenList/add](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/add) In all current engines. Firefox3.6+Safari5.1+Chrome8+ Opera12.1+Edge79+ Edge (Legacy)12+IE10+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView3+Samsung Internet?Opera Mobile12.1+ **✔**MDN [DOMTokenList/contains](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/contains) In all current engines. Firefox3.6+Safari5.1+Chrome8+ Opera12.1+Edge79+ Edge (Legacy)12+IE10+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView3+Samsung Internet?Opera Mobile12.1+ **✔**MDN [DOMTokenList/item](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/item) In all current engines. Firefox3.6+Safari5.1+Chrome8+ Opera12.1+Edge79+ Edge (Legacy)12+IE10+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView3+Samsung Internet?Opera Mobile12.1+ **✔**MDN [DOMTokenList/length](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/length) In all current engines. Firefox3.6+Safari5.1+Chrome8+ Opera12.1+Edge79+ Edge (Legacy)12+IE10+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView3+Samsung Internet?Opera Mobile12.1+ **✔**MDN [DOMTokenList/remove](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/remove) In all current engines. Firefox3.6+Safari5.1+Chrome8+ Opera12.1+Edge79+ Edge (Legacy)12+IE10+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView3+Samsung Internet?Opera Mobile12.1+ **✔**MDN [DOMTokenList/replace](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/replace) In all current engines. Firefox49+Safari10.1+Chrome61+ Opera?Edge79+ Edge (Legacy)17+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [DOMTokenList/supports](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/supports) In all current engines. Firefox49+Safari10.1+Chrome49+ Opera?Edge79+ Edge (Legacy)17+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [DOMTokenList/toggle](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/toggle) In all current engines. Firefox3.6+Safari5.1+Chrome8+ Opera12.1+Edge79+ Edge (Legacy)12+IE10+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView3+Samsung Internet?Opera Mobile12.1+ **✔**MDN [DOMTokenList/value](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/value) In all current engines. Firefox47+Safari10+Chrome50+ Opera?Edge79+ Edge (Legacy)17+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [DOMTokenList](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList) In all current engines. Firefox3.6+Safari5.1+Chrome8+ Opera11.5+Edge79+ Edge (Legacy)12+IE10+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView3+Samsung Internet?Opera Mobile11.5+ **✔**MDN [Document/Document](https://developer.mozilla.org/en-US/docs/Web/API/Document/Document) In all current engines. Firefox20+Safari8+Chrome60+ Opera?Edge79+ Edge (Legacy)17+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [Document/URL](https://developer.mozilla.org/en-US/docs/Web/API/Document/URL) In all current engines. Firefox1+Safari1+Chrome1+ Opera3+Edge79+ Edge (Legacy)12+IE4+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Document/adoptNode](https://developer.mozilla.org/en-US/docs/Web/API/Document/adoptNode) In all current engines. Firefox1+Safari3+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari1+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Document/append](https://developer.mozilla.org/en-US/docs/Web/API/Document/append) In all current engines. Firefox49+Safari10+Chrome54+ Opera?Edge79+ Edge (Legacy)17+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? [DocumentFragment/append](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/append) In all current engines. Firefox49+Safari10+Chrome54+ Opera?Edge79+ Edge (Legacy)17+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? [Element/append](https://developer.mozilla.org/en-US/docs/Web/API/Element/append) In all current engines. Firefox49+Safari10+Chrome54+ Opera?Edge79+ Edge (Legacy)17+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [Document/characterSet](https://developer.mozilla.org/en-US/docs/Web/API/Document/characterSet) In all current engines. Firefox1+Safari3+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari1+Chrome for Android?Android WebView1+Samsung Internet?Opera Mobile12.1+ **✔**MDN [Document/childElementCount](https://developer.mozilla.org/en-US/docs/Web/API/Document/childElementCount) In all current engines. Firefox25+Safari9+Chrome29+ Opera?Edge79+ Edge (Legacy)17+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? [DocumentFragment/childElementCount](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/childElementCount) In all current engines. Firefox25+Safari9+Chrome29+ Opera?Edge79+ Edge (Legacy)17+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? [Element/childElementCount](https://developer.mozilla.org/en-US/docs/Web/API/Element/childElementCount) In all current engines. Firefox3.5+Safari4+Chrome2+ Opera10+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari3+Chrome for Android?Android WebView37+Samsung Internet?Opera Mobile10.1+ **✔**MDN [Document/children](https://developer.mozilla.org/en-US/docs/Web/API/Document/children) In all current engines. Firefox25+Safari9+Chrome29+ Opera?Edge79+ Edge (Legacy)16+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? [DocumentFragment/children](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/children) In all current engines. Firefox25+Safari9+Chrome29+ Opera?Edge79+ Edge (Legacy)16+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? [Element/children](https://developer.mozilla.org/en-US/docs/Web/API/Element/children) In all current engines. Firefox3.5+Safari4+Chrome1+ Opera10+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari3+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Document/compatMode](https://developer.mozilla.org/en-US/docs/Web/API/Document/compatMode) In all current engines. Firefox1+Safari3.1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE6+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Document/contentType](https://developer.mozilla.org/en-US/docs/Web/API/Document/contentType) In all current engines. Firefox1+Safari9+Chrome36+ Opera23+Edge79+ Edge (Legacy)17+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile24+ **✔**MDN [Document/createAttribute](https://developer.mozilla.org/en-US/docs/Web/API/Document/createAttribute) In all current engines. Firefox44+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE6+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Document/createAttributeNS](https://developer.mozilla.org/en-US/docs/Web/API/Document/createAttributeNS) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Document/createCDATASection](https://developer.mozilla.org/en-US/docs/Web/API/Document/createCDATASection) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ [Document/createComment](https://developer.mozilla.org/en-US/docs/Web/API/Document/createComment) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE6+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Document/createDocumentFragment](https://developer.mozilla.org/en-US/docs/Web/API/Document/createDocumentFragment) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE6+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Document/createElement](https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement) In all current engines. Firefox1+Safari1+Chrome1+ Opera6+Edge79+ Edge (Legacy)12+IE5+ Firefox for Android4+iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Document/createElementNS](https://developer.mozilla.org/en-US/docs/Web/API/Document/createElementNS) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android4+iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Document/createEvent](https://developer.mozilla.org/en-US/docs/Web/API/Document/createEvent) In all current engines. Firefox1+Safari1+Chrome1+ Opera7+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android4+iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Document/createExpression](https://developer.mozilla.org/en-US/docs/Web/API/Document/createExpression) In all current engines. Firefox1+Safari3+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IENone Firefox for Android?iOS Safari1+Chrome for Android?Android WebView3+Samsung Internet?Opera Mobile12.1+ [XPathEvaluator/createExpression](https://developer.mozilla.org/en-US/docs/Web/API/XPathEvaluator/createExpression) In all current engines. Firefox1+Safari3+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IENone Firefox for Android?iOS Safari1+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Document/createNodeIterator](https://developer.mozilla.org/en-US/docs/Web/API/Document/createNodeIterator) In all current engines. Firefox1+Safari3+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari1+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Document/createNSResolver](https://developer.mozilla.org/en-US/docs/Web/API/Document/createNSResolver) In all current engines. Firefox1+Safari3+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IENone Firefox for Android?iOS Safari1+Chrome for Android?Android WebView3+Samsung Internet?Opera Mobile12.1+ [XPathEvaluator/createNSResolver](https://developer.mozilla.org/en-US/docs/Web/API/XPathEvaluator/createNSResolver) In all current engines. Firefox1+Safari3+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IENone Firefox for Android?iOS Safari1+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Document/createProcessingInstruction](https://developer.mozilla.org/en-US/docs/Web/API/Document/createProcessingInstruction) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Document/createRange](https://developer.mozilla.org/en-US/docs/Web/API/Document/createRange) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Document/createTextNode](https://developer.mozilla.org/en-US/docs/Web/API/Document/createTextNode) In all current engines. Firefox1+Safari1+Chrome1+ Opera7+Edge79+ Edge (Legacy)12+IE5+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Document/createTreeWalker](https://developer.mozilla.org/en-US/docs/Web/API/Document/createTreeWalker) In all current engines. Firefox1+Safari3+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari3+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Document/doctype](https://developer.mozilla.org/en-US/docs/Web/API/Document/doctype) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE6+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Document/documentElement](https://developer.mozilla.org/en-US/docs/Web/API/Document/documentElement) In all current engines. Firefox1+Safari1+Chrome1+ Opera7+Edge79+ Edge (Legacy)12+IE5+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Document/documentURI](https://developer.mozilla.org/en-US/docs/Web/API/Document/documentURI) In all current engines. Firefox1+Safari3+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)17+IENone Firefox for Android?iOS Safari1+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Document/evaluate](https://developer.mozilla.org/en-US/docs/Web/API/Document/evaluate) In all current engines. Firefox1+Safari3+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IENone Firefox for Android?iOS Safari1+Chrome for Android?Android WebView3+Samsung Internet?Opera Mobile10.1+ [XPathEvaluator/evaluate](https://developer.mozilla.org/en-US/docs/Web/API/XPathEvaluator/evaluate) In all current engines. Firefox1+Safari3+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IENone Firefox for Android?iOS Safari1+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Document/firstElementChild](https://developer.mozilla.org/en-US/docs/Web/API/Document/firstElementChild) In all current engines. Firefox25+Safari9+Chrome29+ Opera?Edge79+ Edge (Legacy)17+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? [DocumentFragment/firstElementChild](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/firstElementChild) In all current engines. Firefox25+Safari9+Chrome29+ Opera?Edge79+ Edge (Legacy)17+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? [Element/firstElementChild](https://developer.mozilla.org/en-US/docs/Web/API/Element/firstElementChild) In all current engines. Firefox3.5+Safari4+Chrome2+ Opera10+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari3+Chrome for Android?Android WebView37+Samsung Internet?Opera Mobile10.1+ **✔**MDN [Document/getElementById](https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementById) In all current engines. Firefox1+Safari1+Chrome1+ Opera7+Edge79+ Edge (Legacy)12+IE5.5+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Document/getElementsByClassName](https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByClassName) In all current engines. Firefox3+Safari3.1+Chrome1+ Opera9.5+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Document/getElementsByTagName](https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByTagName) In all current engines. Firefox1+Safari1+Chrome1+ Opera5.1+Edge79+ Edge (Legacy)12+IE5+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Document/getElementsByTagNameNS](https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByTagNameNS) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Document/implementation](https://developer.mozilla.org/en-US/docs/Web/API/Document/implementation) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE6+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Document/importNode](https://developer.mozilla.org/en-US/docs/Web/API/Document/importNode) In all current engines. Firefox1+Safari1+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Document/lastElementChild](https://developer.mozilla.org/en-US/docs/Web/API/Document/lastElementChild) In all current engines. Firefox25+Safari9+Chrome29+ Opera?Edge79+ Edge (Legacy)17+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? [DocumentFragment/lastElementChild](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/lastElementChild) In all current engines. Firefox25+Safari9+Chrome29+ Opera?Edge79+ Edge (Legacy)17+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? [Element/lastElementChild](https://developer.mozilla.org/en-US/docs/Web/API/Element/lastElementChild) In all current engines. Firefox3.5+Safari4+Chrome2+ Opera10+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari3+Chrome for Android?Android WebView37+Samsung Internet?Opera Mobile10.1+ **✔**MDN [Document/prepend](https://developer.mozilla.org/en-US/docs/Web/API/Document/prepend) In all current engines. Firefox49+Safari10+Chrome54+ Opera?Edge79+ Edge (Legacy)17+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? [DocumentFragment/prepend](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/prepend) In all current engines. Firefox49+Safari10+Chrome54+ Opera?Edge79+ Edge (Legacy)17+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? [Element/prepend](https://developer.mozilla.org/en-US/docs/Web/API/Element/prepend) In all current engines. Firefox49+Safari10+Chrome54+ Opera?Edge79+ Edge (Legacy)17+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [Document/querySelector](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector) In all current engines. Firefox3.5+Safari3.1+Chrome1+ Opera10+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ [DocumentFragment/querySelector](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/querySelector) In all current engines. Firefox3.5+Safari4+Chrome2+ Opera10+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari3+Chrome for Android?Android WebView37+Samsung Internet?Opera Mobile10.1+ **✔**MDN [Document/querySelectorAll](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll) In all current engines. Firefox3.5+Safari3.1+Chrome1+ Opera10+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ [DocumentFragment/querySelectorAll](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/querySelectorAll) In all current engines. Firefox3.5+Safari4+Chrome2+ Opera10+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari3+Chrome for Android?Android WebView37+Samsung Internet?Opera Mobile10.1+ [Element/querySelector](https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelector) In all current engines. Firefox3.5+Safari3.1+Chrome1+ Opera10+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ [Element/querySelectorAll](https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelectorAll) In all current engines. Firefox3.5+Safari3.1+Chrome1+ Opera10+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Document/replaceChildren](https://developer.mozilla.org/en-US/docs/Web/API/Document/replaceChildren) In all current engines. Firefox78+Safari14+Chrome86+ Opera?Edge86+ Edge (Legacy)?IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? [DocumentFragment/replaceChildren](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/replaceChildren) In all current engines. Firefox78+Safari14+Chrome86+ Opera?Edge86+ Edge (Legacy)?IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? [Element/replaceChildren](https://developer.mozilla.org/en-US/docs/Web/API/Element/replaceChildren) In all current engines. Firefox78+Safari14+Chrome86+ Opera?Edge86+ Edge (Legacy)?IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [Document](https://developer.mozilla.org/en-US/docs/Web/API/Document) In all current engines. Firefox1+Safari1+Chrome1+ Opera3+Edge79+ Edge (Legacy)12+IE4+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView37+Samsung Internet?Opera Mobile10.1+ **✔**MDN [DocumentFragment/DocumentFragment](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/DocumentFragment) In all current engines. Firefox24+Safari8+Chrome29+ Opera?Edge79+ Edge (Legacy)17+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [DocumentFragment/getElementById](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment/getElementById) In all current engines. Firefox28+Safari9+Chrome36+ Opera?Edge79+ Edge (Legacy)17+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [DocumentFragment](https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment) In all current engines. Firefox1+Safari3+Chrome1+ Opera8+Edge79+ Edge (Legacy)12+IE6+ Firefox for Android?iOS Safari1+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [DocumentType/name](https://developer.mozilla.org/en-US/docs/Web/API/DocumentType/name) In all current engines. Firefox1+Safari3+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari1+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [DocumentType/publicId](https://developer.mozilla.org/en-US/docs/Web/API/DocumentType/publicId) In all current engines. Firefox1+Safari3+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari1+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [DocumentType/systemId](https://developer.mozilla.org/en-US/docs/Web/API/DocumentType/systemId) In all current engines. Firefox1+Safari3+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari1+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [DocumentType](https://developer.mozilla.org/en-US/docs/Web/API/DocumentType) In all current engines. Firefox1+Safari3+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari1+Chrome for Android?Android WebView37+Samsung Internet?Opera Mobile12.1+ **✔**MDN [Element/assignedSlot](https://developer.mozilla.org/en-US/docs/Web/API/Element/assignedSlot) In all current engines. Firefox63+Safari10+Chrome53+ Opera?Edge79+ Edge (Legacy)?IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? [Text/assignedSlot](https://developer.mozilla.org/en-US/docs/Web/API/Text/assignedSlot) In all current engines. Firefox63+Safari10+Chrome53+ Opera?Edge79+ Edge (Legacy)?IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [Element/attachShadow](https://developer.mozilla.org/en-US/docs/Web/API/Element/attachShadow) In all current engines. Firefox63+Safari10+Chrome53+ Opera?Edge79+ Edge (Legacy)?IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [Element/attributes](https://developer.mozilla.org/en-US/docs/Web/API/Element/attributes) In all current engines. Firefox1+Safari1+Chrome1+ Opera8+Edge79+ Edge (Legacy)12+IE5.5+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Element/classList](https://developer.mozilla.org/en-US/docs/Web/API/Element/classList) In all current engines. Firefox3.6+Safari7+Chrome22+ Opera11.5+Edge79+ Edge (Legacy)16+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView4.4+Samsung Internet?Opera Mobile11.5+ **✔**MDN [Element/className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) In all current engines. Firefox1+Safari1+Chrome22+ Opera8+Edge79+ Edge (Legacy)12+IE5+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Element/closest](https://developer.mozilla.org/en-US/docs/Web/API/Element/closest) In all current engines. Firefox35+Safari6+Chrome41+ Opera?Edge79+ Edge (Legacy)15+IENone Firefox for Android?iOS Safari9+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [Element/getAttribute](https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute) In all current engines. Firefox1+Safari1+Chrome1+ Opera8+Edge79+ Edge (Legacy)12+IE5+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Element/getAttributeNames](https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttributeNames) In all current engines. Firefox45+Safari10.1+Chrome61+ Opera?Edge79+ Edge (Legacy)18IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [Element/getAttributeNode](https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttributeNode) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE6+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Element/getAttributeNodeNS](https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttributeNodeNS) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Element/getAttributeNS](https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttributeNS) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Element/getElementsByClassName](https://developer.mozilla.org/en-US/docs/Web/API/Element/getElementsByClassName) In all current engines. Firefox3+Safari3.1+Chrome1+ Opera9.5+Edge79+ Edge (Legacy)16+IENone Firefox for Android4+iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Element/getElementsByTagName](https://developer.mozilla.org/en-US/docs/Web/API/Element/getElementsByTagName) In all current engines. Firefox1+Safari1+Chrome1+ Opera8+Edge79+ Edge (Legacy)12+IE5.5+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Element/getElementsByTagNameNS](https://developer.mozilla.org/en-US/docs/Web/API/Element/getElementsByTagNameNS) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android4+iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Element/hasAttribute](https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttribute) In all current engines. Firefox1+Safari1+Chrome1+ Opera8+Edge79+ Edge (Legacy)12+IE8+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Element/hasAttributeNS](https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttributeNS) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Element/hasAttributes](https://developer.mozilla.org/en-US/docs/Web/API/Element/hasAttributes) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE8+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Element/id](https://developer.mozilla.org/en-US/docs/Web/API/Element/id) In all current engines. Firefox1+Safari1+Chrome23+ Opera12.1+Edge79+ Edge (Legacy)12+IE5+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Element/insertAdjacentElement](https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentElement) In all current engines. Firefox48+Safari3+Chrome1+ Opera8+Edge79+ Edge (Legacy)17+IENone Firefox for Android?iOS Safari1+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Element/insertAdjacentText](https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentText) In all current engines. Firefox48+Safari4+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)17+IENone Firefox for Android?iOS Safari4+Chrome for Android?Android WebView2.2+Samsung Internet?Opera Mobile12.1+ **✔**MDN [Element/localName](https://developer.mozilla.org/en-US/docs/Web/API/Element/localName) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Element/matches](https://developer.mozilla.org/en-US/docs/Web/API/Element/matches) In all current engines. Firefox34+Safari8+Chrome33+ Opera21+Edge79+ Edge (Legacy)15+IENone Firefox for Android34+iOS Safari?Chrome for Android?Android WebView4.4+Samsung Internet?Opera Mobile21+ **✔**MDN [Element/namespaceURI](https://developer.mozilla.org/en-US/docs/Web/API/Element/namespaceURI) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Element/prefix](https://developer.mozilla.org/en-US/docs/Web/API/Element/prefix) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Element/removeAttribute](https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttribute) In all current engines. Firefox1+Safari1+Chrome1+ Opera8+Edge79+ Edge (Legacy)12+IE5+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Element/removeAttributeNode](https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttributeNode) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE6+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Element/removeAttributeNS](https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttributeNS) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Element/setAttribute](https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute) In all current engines. Firefox1+Safari1+Chrome1+ Opera8+Edge79+ Edge (Legacy)12+IE5+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Element/setAttributeNode](https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttributeNode) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE6+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Element/setAttributeNodeNS](https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttributeNodeNS) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Element/setAttributeNS](https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttributeNS) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Element/shadowRoot](https://developer.mozilla.org/en-US/docs/Web/API/Element/shadowRoot) In all current engines. Firefox63+Safari10+Chrome35+ Opera?Edge79+ Edge (Legacy)?IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [Element/slot](https://developer.mozilla.org/en-US/docs/Web/API/Element/slot) In all current engines. Firefox63+Safari10+Chrome53+ Opera?Edge79+ Edge (Legacy)?IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? [Global_attributes/slot](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/slot) In all current engines. Firefox63+Safari10+Chrome53+ Opera?Edge79+ Edge (Legacy)NoneIE? Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [Element/tagName](https://developer.mozilla.org/en-US/docs/Web/API/Element/tagName) In all current engines. Firefox1+Safari1+Chrome1+ Opera8+Edge79+ Edge (Legacy)12+IE5+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Element/toggleAttribute](https://developer.mozilla.org/en-US/docs/Web/API/Element/toggleAttribute) In all current engines. Firefox63+Safari12+Chrome69+ Opera?Edge79+ Edge (Legacy)18IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [Element](https://developer.mozilla.org/en-US/docs/Web/API/Element) In all current engines. Firefox1+Safari1+Chrome1+ Opera8+Edge79+ Edge (Legacy)12+IE4+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView37+Samsung Internet?Opera Mobile10.1+ **✔**MDN [Event/Event](https://developer.mozilla.org/en-US/docs/Web/API/Event/Event) In all current engines. Firefox11+Safari6+Chrome15+ Opera11.6+Edge79+ Edge (Legacy)12+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12+ Node.js15.0.0+ **✔**MDN [Event/bubbles](https://developer.mozilla.org/en-US/docs/Web/API/Event/bubbles) In all current engines. Firefox1.5+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView37+Samsung Internet?Opera Mobile12.1+ Node.js14.5.0+ **✔**MDN [Event/cancelable](https://developer.mozilla.org/en-US/docs/Web/API/Event/cancelable) In all current engines. Firefox1.5+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView37+Samsung Internet?Opera Mobile12.1+ Node.js14.5.0+ **✔**MDN [Event/composed](https://developer.mozilla.org/en-US/docs/Web/API/Event/composed) In all current engines. Firefox52+Safari10+Chrome53+ Opera?Edge79+ Edge (Legacy)?IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? Node.js14.5.0+ **✔**MDN [Event/composedPath](https://developer.mozilla.org/en-US/docs/Web/API/Event/composedPath) In all current engines. Firefox59+Safari10+Chrome53+ Opera?Edge79+ Edge (Legacy)?IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? Node.js14.5.0+ **✔**MDN [Event/currentTarget](https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget) In all current engines. Firefox1+Safari1+Chrome1+ Opera7+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ Node.js14.5.0+ **✔**MDN [Event/defaultPrevented](https://developer.mozilla.org/en-US/docs/Web/API/Event/defaultPrevented) In all current engines. Firefox6+Safari5+Chrome5+ Opera11+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari5+Chrome for Android?Android WebView3+Samsung Internet?Opera Mobile11+ Node.js14.5.0+ **✔**MDN [Event/eventPhase](https://developer.mozilla.org/en-US/docs/Web/API/Event/eventPhase) In all current engines. Firefox1.5+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ Node.js14.5.0+ **✔**MDN [Event/isTrusted](https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted) In all current engines. Firefox1.5+Safari10+Chrome46+ Opera33+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView46+Samsung Internet?Opera Mobile33+ Node.js14.5.0+ **✔**MDN [Event/preventDefault](https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault) In all current engines. Firefox1+Safari1+Chrome1+ Opera7+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ Node.js14.5.0+ **✔**MDN [Event/stopImmediatePropagation](https://developer.mozilla.org/en-US/docs/Web/API/Event/stopImmediatePropagation) In all current engines. Firefox10+Safari5+Chrome5+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari5+Chrome for Android?Android WebView37+Samsung Internet?Opera Mobile12.1+ Node.js14.5.0+ **✔**MDN [Event/stopPropagation](https://developer.mozilla.org/en-US/docs/Web/API/Event/stopPropagation) In all current engines. Firefox1+Safari1+Chrome1+ Opera7+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ Node.js14.5.0+ **✔**MDN [Event/target](https://developer.mozilla.org/en-US/docs/Web/API/Event/target) In all current engines. Firefox1+Safari1+Chrome1+ Opera7+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ Node.js14.5.0+ **✔**MDN [Event/timeStamp](https://developer.mozilla.org/en-US/docs/Web/API/Event/timeStamp) In all current engines. Firefox1.5+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView1+Samsung Internet?Opera Mobile12.1+ Node.js14.5.0+ **✔**MDN [Event/type](https://developer.mozilla.org/en-US/docs/Web/API/Event/type) In all current engines. Firefox1.5+Safari1+Chrome1+ Opera7+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ Node.js14.5.0+ **✔**MDN [Event](https://developer.mozilla.org/en-US/docs/Web/API/Event) In all current engines. Firefox1+Safari1+Chrome1+ Opera4+Edge79+ Edge (Legacy)12+IE6+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView37+Samsung Internet?Opera Mobile10.1+ Node.js14.5.0+ **✔**MDN [EventTarget/EventTarget](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/EventTarget) In all current engines. Firefox59+Safari14+Chrome64+ Opera?Edge79+ Edge (Legacy)?IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? Node.js15.0.0+ **✔**MDN [EventTarget/addEventListener](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener) In all current engines. Firefox1+Safari1+Chrome1+ Opera7+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView1+Samsung Internet?Opera Mobile10.1+ Node.js14.5.0+ **✔**MDN [EventTarget/dispatchEvent](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/dispatchEvent) In all current engines. Firefox2+Safari3.1+Chrome4+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari3+Chrome for Android?Android WebView4+Samsung Internet?Opera Mobile10.1+ Node.js14.5.0+ **✔**MDN [EventTarget/removeEventListener](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener) In all current engines. Firefox1+Safari1+Chrome1+ Opera7+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ Node.js14.5.0+ **✔**MDN [EventTarget](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget) In all current engines. Firefox1+Safari1+Chrome1+ Opera7+Edge79+ Edge (Legacy)12+IE6+ Firefox for Android?iOS Safari1+Chrome for Android?Android WebView37+Samsung Internet?Opera Mobile10.1+ Node.js14.5.0+ **✔**MDN [HTMLCollection/item](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCollection/item) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE8+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [HTMLCollection/length](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCollection/length) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE8+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [HTMLCollection/namedItem](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCollection/namedItem) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE8+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [HTMLCollection](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCollection) In all current engines. Firefox1+Safari1+Chrome1+ Opera8+Edge79+ Edge (Legacy)12+IE8+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [HTMLSlotElement/slotchange_event](https://developer.mozilla.org/en-US/docs/Web/API/HTMLSlotElement/slotchange_event) In all current engines. Firefox63+Safari10.1+Chrome53+ Opera?Edge79+ Edge (Legacy)?IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [MutationObserver/MutationObserver](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver/MutationObserver) In all current engines. Firefox14+Safari7+Chrome26+ Opera15+Edge79+ Edge (Legacy)12+IE11 Firefox for Android?iOS Safari?Chrome for Android?Android WebView4.4+Samsung Internet?Opera Mobile14+ **✔**MDN [MutationObserver/disconnect](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver/disconnect) In all current engines. Firefox14+Safari6+Chrome18+ Opera?Edge79+ Edge (Legacy)12+IE11 Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [MutationObserver/observe](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver/observe) In all current engines. Firefox14+Safari6+Chrome18+ Opera?Edge79+ Edge (Legacy)12+IE11 Firefox for Android?iOS Safari6+Chrome for Android?Android WebView4.4+Samsung Internet?Opera Mobile? **✔**MDN [MutationObserver/takeRecords](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver/takeRecords) In all current engines. Firefox14+Safari6+Chrome20+ Opera?Edge79+ Edge (Legacy)12+IE11 Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [MutationObserver](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver) In all current engines. Firefox14+Safari7+Chrome26+ Opera15+Edge79+ Edge (Legacy)12+IE11 Firefox for Android?iOS Safari?Chrome for Android?Android WebView4.4+Samsung Internet?Opera Mobile14+ **✔**MDN [MutationRecord/addedNodes](https://developer.mozilla.org/en-US/docs/Web/API/MutationRecord/addedNodes) In all current engines. Firefox14+Safari7+Chrome16+ Opera?Edge79+ Edge (Legacy)12+IE11 Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [MutationRecord/attributeName](https://developer.mozilla.org/en-US/docs/Web/API/MutationRecord/attributeName) In all current engines. Firefox14+Safari7+Chrome16+ Opera?Edge79+ Edge (Legacy)12+IE11 Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [MutationRecord/attributeNamespace](https://developer.mozilla.org/en-US/docs/Web/API/MutationRecord/attributeNamespace) In all current engines. Firefox14+Safari7+Chrome16+ Opera?Edge79+ Edge (Legacy)12+IE11 Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [MutationRecord/nextSibling](https://developer.mozilla.org/en-US/docs/Web/API/MutationRecord/nextSibling) In all current engines. Firefox14+Safari7+Chrome16+ Opera?Edge79+ Edge (Legacy)12+IE11 Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [MutationRecord/oldValue](https://developer.mozilla.org/en-US/docs/Web/API/MutationRecord/oldValue) In all current engines. Firefox14+Safari7+Chrome16+ Opera?Edge79+ Edge (Legacy)12+IE11 Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [MutationRecord/previousSibling](https://developer.mozilla.org/en-US/docs/Web/API/MutationRecord/previousSibling) In all current engines. Firefox14+Safari7+Chrome16+ Opera?Edge79+ Edge (Legacy)12+IE11 Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [MutationRecord/removedNodes](https://developer.mozilla.org/en-US/docs/Web/API/MutationRecord/removedNodes) In all current engines. Firefox14+Safari7+Chrome16+ Opera?Edge79+ Edge (Legacy)12+IE11 Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [MutationRecord/target](https://developer.mozilla.org/en-US/docs/Web/API/MutationRecord/target) In all current engines. Firefox14+Safari7+Chrome16+ Opera?Edge79+ Edge (Legacy)12+IE11 Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [MutationRecord/type](https://developer.mozilla.org/en-US/docs/Web/API/MutationRecord/type) In all current engines. Firefox14+Safari7+Chrome16+ Opera?Edge79+ Edge (Legacy)12+IE11 Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [MutationRecord](https://developer.mozilla.org/en-US/docs/Web/API/MutationRecord) In all current engines. Firefox14+Safari7+Chrome16+ Opera?Edge79+ Edge (Legacy)12+IE11 Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [NamedNodeMap/getNamedItem](https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap/getNamedItem) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE6+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [NamedNodeMap/getNamedItemNS](https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap/getNamedItemNS) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [NamedNodeMap/item](https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap/item) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE5+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [NamedNodeMap/length](https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap/length) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE5+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [NamedNodeMap/removeNamedItem](https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap/removeNamedItem) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE6+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [NamedNodeMap/removeNamedItemNS](https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap/removeNamedItemNS) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [NamedNodeMap/setNamedItem](https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap/setNamedItem) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE6+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [NamedNodeMap/setNamedItemNS](https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap/setNamedItemNS) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [NamedNodeMap](https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap) In all current engines. Firefox34+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE5+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Node/appendChild](https://developer.mozilla.org/en-US/docs/Web/API/Node/appendChild) In all current engines. Firefox1+Safari1.1+Chrome1+ Opera7+Edge79+ Edge (Legacy)12+IE5+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Node/baseURI](https://developer.mozilla.org/en-US/docs/Web/API/Node/baseURI) In all current engines. Firefox1+Safari4+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IENone Firefox for Android?iOS Safari1+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Node/childNodes](https://developer.mozilla.org/en-US/docs/Web/API/Node/childNodes) In all current engines. Firefox1+Safari1.2+Chrome1+ Opera7+Edge79+ Edge (Legacy)12+IE5+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Node/cloneNode](https://developer.mozilla.org/en-US/docs/Web/API/Node/cloneNode) In all current engines. Firefox1+Safari1.1+Chrome1+ Opera7+Edge79+ Edge (Legacy)12+IE6+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Node/compareDocumentPosition](https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition) In all current engines. Firefox1+Safari4+Chrome2+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView37+Samsung Internet?Opera Mobile12.1+ **✔**MDN [Node/contains](https://developer.mozilla.org/en-US/docs/Web/API/Node/contains) In all current engines. Firefox9+Safari1.1+Chrome16+ Opera7+Edge79+ Edge (Legacy)12+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Node/firstChild](https://developer.mozilla.org/en-US/docs/Web/API/Node/firstChild) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE6+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Node/getRootNode](https://developer.mozilla.org/en-US/docs/Web/API/Node/getRootNode) In all current engines. Firefox53+Safari10.1+Chrome54+ Opera?Edge79+ Edge (Legacy)?IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [Node/hasChildNodes](https://developer.mozilla.org/en-US/docs/Web/API/Node/hasChildNodes) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE6+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Node/insertBefore](https://developer.mozilla.org/en-US/docs/Web/API/Node/insertBefore) In all current engines. Firefox1+Safari1.1+Chrome1+ Opera7+Edge79+ Edge (Legacy)12+IE6+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Node/isConnected](https://developer.mozilla.org/en-US/docs/Web/API/Node/isConnected) In all current engines. Firefox49+Safari10+Chrome51+ Opera?Edge79+ Edge (Legacy)?IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet6.0+Opera Mobile? **✔**MDN [Node/isDefaultNamespace](https://developer.mozilla.org/en-US/docs/Web/API/Node/isDefaultNamespace) In all current engines. Firefox1+Safari3+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari1+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Node/isEqualNode](https://developer.mozilla.org/en-US/docs/Web/API/Node/isEqualNode) In all current engines. Firefox1+Safari3+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari1+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Node/isSameNode](https://developer.mozilla.org/en-US/docs/Web/API/Node/isSameNode) In all current engines. Firefox48+Safari3+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari1+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Node/lastChild](https://developer.mozilla.org/en-US/docs/Web/API/Node/lastChild) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE6+ Firefox for Android45+iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Node/lookupNamespaceURI](https://developer.mozilla.org/en-US/docs/Web/API/Node/lookupNamespaceURI) In all current engines. Firefox1+Safari3+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari1+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Node/lookupPrefix](https://developer.mozilla.org/en-US/docs/Web/API/Node/lookupPrefix) In all current engines. Firefox1+Safari3+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari1+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Node/nextSibling](https://developer.mozilla.org/en-US/docs/Web/API/Node/nextSibling) In all current engines. Firefox1+Safari1.1+Chrome1+ Opera7+Edge79+ Edge (Legacy)12+IE5.5+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Node/nodeName](https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeName) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE6+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Node/nodeType](https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType) In all current engines. Firefox1+Safari1.1+Chrome1+ Opera7+Edge79+ Edge (Legacy)12+IE6+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Node/nodeValue](https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeValue) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE6+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Node/normalize](https://developer.mozilla.org/en-US/docs/Web/API/Node/normalize) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Node/ownerDocument](https://developer.mozilla.org/en-US/docs/Web/API/Node/ownerDocument) In all current engines. Firefox9+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE6+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Node/parentElement](https://developer.mozilla.org/en-US/docs/Web/API/Node/parentElement) In all current engines. Firefox9+Safari1.1+Chrome1+ Opera7+Edge79+ Edge (Legacy)12+IE8+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Node/parentNode](https://developer.mozilla.org/en-US/docs/Web/API/Node/parentNode) In all current engines. Firefox1+Safari1.1+Chrome1+ Opera7+Edge79+ Edge (Legacy)12+IE5.5+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Node/previousSibling](https://developer.mozilla.org/en-US/docs/Web/API/Node/previousSibling) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE5.5+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Node/removeChild](https://developer.mozilla.org/en-US/docs/Web/API/Node/removeChild) In all current engines. Firefox1+Safari1.1+Chrome1+ Opera7+Edge79+ Edge (Legacy)12+IE5+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Node/replaceChild](https://developer.mozilla.org/en-US/docs/Web/API/Node/replaceChild) In all current engines. Firefox1+Safari1.1+Chrome1+ Opera7+Edge79+ Edge (Legacy)12+IE6+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Node/textContent](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent) In all current engines. Firefox1+Safari3+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari1+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Node](https://developer.mozilla.org/en-US/docs/Web/API/Node) In all current engines. Firefox1+Safari1+Chrome1+ Opera7+Edge79+ Edge (Legacy)12+IE5+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView37+Samsung Internet?Opera Mobile10.1+ **✔**MDN [NodeIterator/filter](https://developer.mozilla.org/en-US/docs/Web/API/NodeIterator/filter) In all current engines. Firefox3.5+Safari3+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari3+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [NodeIterator/nextNode](https://developer.mozilla.org/en-US/docs/Web/API/NodeIterator/nextNode) In all current engines. Firefox3.5+Safari3+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari3+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [NodeIterator/pointerBeforeReferenceNode](https://developer.mozilla.org/en-US/docs/Web/API/NodeIterator/pointerBeforeReferenceNode) In all current engines. Firefox3.5+Safari3+Chrome1+ Opera15+Edge79+ Edge (Legacy)17+IENone Firefox for Android?iOS Safari3+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile14+ **✔**MDN [NodeIterator/previousNode](https://developer.mozilla.org/en-US/docs/Web/API/NodeIterator/previousNode) In all current engines. Firefox3.5+Safari3+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari3+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [NodeIterator/referenceNode](https://developer.mozilla.org/en-US/docs/Web/API/NodeIterator/referenceNode) In all current engines. Firefox3.5+Safari3+Chrome1+ Opera15+Edge79+ Edge (Legacy)17+IENone Firefox for Android?iOS Safari3+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile14+ **✔**MDN [NodeIterator/root](https://developer.mozilla.org/en-US/docs/Web/API/NodeIterator/root) In all current engines. Firefox3.5+Safari3+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari3+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [NodeIterator/whatToShow](https://developer.mozilla.org/en-US/docs/Web/API/NodeIterator/whatToShow) In all current engines. Firefox3.5+Safari3+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari3+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [NodeIterator](https://developer.mozilla.org/en-US/docs/Web/API/NodeIterator) In all current engines. Firefox3.5+Safari3+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari3+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [NodeList/forEach](https://developer.mozilla.org/en-US/docs/Web/API/NodeList/forEach) In all current engines. Firefox50+Safari10+Chrome51+ Opera?Edge79+ Edge (Legacy)16+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? [Reference/Global_Objects/Array/@@iterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/@@iterator) In all current engines. Firefox36+Safari10+Chrome51+ Opera?Edge79+ Edge (Legacy)?IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? [NodeList](https://developer.mozilla.org/en-US/docs/Web/API/NodeList) In all current engines. Firefox1+Safari1+Chrome1+ Opera8+Edge79+ Edge (Legacy)12+IE5+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [NodeList/item](https://developer.mozilla.org/en-US/docs/Web/API/NodeList/item) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE5+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [NodeList/length](https://developer.mozilla.org/en-US/docs/Web/API/NodeList/length) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE5+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [ProcessingInstruction/target](https://developer.mozilla.org/en-US/docs/Web/API/ProcessingInstruction/target) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [ProcessingInstruction](https://developer.mozilla.org/en-US/docs/Web/API/ProcessingInstruction) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Range/Range](https://developer.mozilla.org/en-US/docs/Web/API/Range/Range) In all current engines. Firefox24+Safari8+Chrome29+ Opera?Edge79+ Edge (Legacy)15+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [Range/cloneContents](https://developer.mozilla.org/en-US/docs/Web/API/Range/cloneContents) In all current engines. Firefox1+Safari1+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Range/cloneRange](https://developer.mozilla.org/en-US/docs/Web/API/Range/cloneRange) In all current engines. Firefox1+Safari1+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Range/collapse](https://developer.mozilla.org/en-US/docs/Web/API/Range/collapse) In all current engines. Firefox1+Safari1+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Range/commonAncestorContainer](https://developer.mozilla.org/en-US/docs/Web/API/Range/commonAncestorContainer) In all current engines. Firefox1+Safari1+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Range/compareBoundaryPoints](https://developer.mozilla.org/en-US/docs/Web/API/Range/compareBoundaryPoints) In all current engines. Firefox1+Safari1+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Range/comparePoint](https://developer.mozilla.org/en-US/docs/Web/API/Range/comparePoint) In all current engines. Firefox1+Safari3+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)17+IENone Firefox for Android?iOS Safari1+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Range/deleteContents](https://developer.mozilla.org/en-US/docs/Web/API/Range/deleteContents) In all current engines. Firefox1+Safari1+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ MDN [Range/detach](https://developer.mozilla.org/en-US/docs/Web/API/Range/detach) Firefox1–15Safari1+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Range/extractContents](https://developer.mozilla.org/en-US/docs/Web/API/Range/extractContents) In all current engines. Firefox1+Safari1+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Range/insertNode](https://developer.mozilla.org/en-US/docs/Web/API/Range/insertNode) In all current engines. Firefox1+Safari1+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Range/intersectsNode](https://developer.mozilla.org/en-US/docs/Web/API/Range/intersectsNode) In all current engines. Firefox17+Safari3+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)17+IENone Firefox for Android19+iOS Safari1+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Range/isPointInRange](https://developer.mozilla.org/en-US/docs/Web/API/Range/isPointInRange) In all current engines. Firefox1+Safari3+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)15+IENone Firefox for Android?iOS Safari1+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Range/selectNode](https://developer.mozilla.org/en-US/docs/Web/API/Range/selectNode) In all current engines. Firefox1+Safari1+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Range/selectNodeContents](https://developer.mozilla.org/en-US/docs/Web/API/Range/selectNodeContents) In all current engines. Firefox1+Safari1+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Range/setEnd](https://developer.mozilla.org/en-US/docs/Web/API/Range/setEnd) In all current engines. Firefox1+Safari1+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Range/setEndAfter](https://developer.mozilla.org/en-US/docs/Web/API/Range/setEndAfter) In all current engines. Firefox1+Safari1+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Range/setEndBefore](https://developer.mozilla.org/en-US/docs/Web/API/Range/setEndBefore) In all current engines. Firefox1+Safari1+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Range/setStart](https://developer.mozilla.org/en-US/docs/Web/API/Range/setStart) In all current engines. Firefox1+Safari1+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Range/setStartAfter](https://developer.mozilla.org/en-US/docs/Web/API/Range/setStartAfter) In all current engines. Firefox1+Safari1+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Range/setStartBefore](https://developer.mozilla.org/en-US/docs/Web/API/Range/setStartBefore) In all current engines. Firefox1+Safari1+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Range/surroundContents](https://developer.mozilla.org/en-US/docs/Web/API/Range/surroundContents) In all current engines. Firefox1+Safari1+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Range/toString](https://developer.mozilla.org/en-US/docs/Web/API/Range/toString) In all current engines. Firefox1+Safari1+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [Range](https://developer.mozilla.org/en-US/docs/Web/API/Range) In all current engines. Firefox1+Safari1+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile10.1+ **✔**MDN [ShadowRoot/delegatesFocus](https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/delegatesFocus) In all current engines. Firefox94+Safari15+Chrome53+ Opera?Edge79+ Edge (Legacy)?IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [ShadowRoot/host](https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/host) In all current engines. Firefox63+Safari10+Chrome53+ Opera?Edge79+ Edge (Legacy)?IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [ShadowRoot/mode](https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/mode) In all current engines. Firefox63+Safari10.1+Chrome53+ Opera?Edge79+ Edge (Legacy)?IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [ShadowRoot/slotAssignment](https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/slotAssignment) In all current engines. Firefox92+Safari16.4+Chrome86+ Opera?Edge86+ Edge (Legacy)?IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [ShadowRoot](https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot) In all current engines. Firefox63+Safari10+Chrome53+ Opera?Edge79+ Edge (Legacy)?IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [StaticRange/StaticRange](https://developer.mozilla.org/en-US/docs/Web/API/StaticRange/StaticRange) In all current engines. Firefox71+Safari13.1+Chrome90+ Opera?Edge90+ Edge (Legacy)?IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [StaticRange](https://developer.mozilla.org/en-US/docs/Web/API/StaticRange) In all current engines. Firefox69+Safari10.1+Chrome60+ Opera?Edge79+ Edge (Legacy)18IENone Firefox for Android79+iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [Text/Text](https://developer.mozilla.org/en-US/docs/Web/API/Text/Text) In all current engines. Firefox24+Safari8+Chrome29+ Opera?Edge79+ Edge (Legacy)16+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile? **✔**MDN [Text/splitText](https://developer.mozilla.org/en-US/docs/Web/API/Text/splitText) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE5+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView1+Samsung Internet?Opera Mobile12.1+ **✔**MDN [Text/wholeText](https://developer.mozilla.org/en-US/docs/Web/API/Text/wholeText) In all current engines. Firefox3.5+Safari4+Chrome2+ Opera12.1+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [Text](https://developer.mozilla.org/en-US/docs/Web/API/Text) In all current engines. Firefox1+Safari1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IE5+ Firefox for Android?iOS Safari?Chrome for Android?Android WebView37+Samsung Internet?Opera Mobile12.1+ **✔**MDN [TreeWalker/currentNode](https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker/currentNode) In all current engines. Firefox4+Safari3+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari3+Chrome for Android?Android WebView3+Samsung Internet?Opera Mobile10.1+ **✔**MDN [TreeWalker/filter](https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker/filter) In all current engines. Firefox4+Safari3+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari3+Chrome for Android?Android WebView3+Samsung Internet?Opera Mobile10.1+ **✔**MDN [TreeWalker/firstChild](https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker/firstChild) In all current engines. Firefox4+Safari3+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari3+Chrome for Android?Android WebView3+Samsung Internet?Opera Mobile10.1+ **✔**MDN [TreeWalker/lastChild](https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker/lastChild) In all current engines. Firefox4+Safari3+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari3+Chrome for Android?Android WebView3+Samsung Internet?Opera Mobile10.1+ **✔**MDN [TreeWalker/nextNode](https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker/nextNode) In all current engines. Firefox4+Safari3+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari3+Chrome for Android?Android WebView3+Samsung Internet?Opera Mobile10.1+ **✔**MDN [TreeWalker/nextSibling](https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker/nextSibling) In all current engines. Firefox4+Safari3+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari3+Chrome for Android?Android WebView3+Samsung Internet?Opera Mobile10.1+ **✔**MDN [TreeWalker/parentNode](https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker/parentNode) In all current engines. Firefox4+Safari3+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari3+Chrome for Android?Android WebView3+Samsung Internet?Opera Mobile10.1+ **✔**MDN [TreeWalker/previousNode](https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker/previousNode) In all current engines. Firefox4+Safari3+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari3+Chrome for Android?Android WebView3+Samsung Internet?Opera Mobile10.1+ **✔**MDN [TreeWalker/previousSibling](https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker/previousSibling) In all current engines. Firefox4+Safari3+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari3+Chrome for Android?Android WebView3+Samsung Internet?Opera Mobile10.1+ **✔**MDN [TreeWalker/root](https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker/root) In all current engines. Firefox4+Safari3+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari3+Chrome for Android?Android WebView3+Samsung Internet?Opera Mobile10.1+ **✔**MDN [TreeWalker/whatToShow](https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker/whatToShow) In all current engines. Firefox4+Safari3+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari3+Chrome for Android?Android WebView3+Samsung Internet?Opera Mobile10.1+ **✔**MDN [TreeWalker](https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker) In all current engines. Firefox4+Safari3+Chrome1+ Opera9+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android?iOS Safari3+Chrome for Android?Android WebView3+Samsung Internet?Opera Mobile10.1+ **✔**MDN [XMLDocument](https://developer.mozilla.org/en-US/docs/Web/API/XMLDocument) In all current engines. Firefox1+Safari10+Chrome34+ Opera21+Edge79+ Edge (Legacy)12+IE11 Firefox for Android?iOS Safari10+Chrome for Android?Android WebView37+Samsung Internet?Opera Mobile21+ **✔**MDN [XPathEvaluator/XPathEvaluator](https://developer.mozilla.org/en-US/docs/Web/API/XPathEvaluator/XPathEvaluator) In all current engines. Firefox1+Safari3+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IENone Firefox for Android?iOS Safari1+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [XPathEvaluator](https://developer.mozilla.org/en-US/docs/Web/API/XPathEvaluator) In all current engines. Firefox1+Safari3+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IENone Firefox for Android?iOS Safari1+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [XPathExpression/evaluate](https://developer.mozilla.org/en-US/docs/Web/API/XPathExpression/evaluate) In all current engines. Firefox1+Safari3+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IENone Firefox for Android?iOS Safari1+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [XPathExpression](https://developer.mozilla.org/en-US/docs/Web/API/XPathExpression) In all current engines. Firefox1+Safari3+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IENone Firefox for Android?iOS Safari1+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [XPathResult/booleanValue](https://developer.mozilla.org/en-US/docs/Web/API/XPathResult/booleanValue) In all current engines. Firefox1+Safari3+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IENone Firefox for Android?iOS Safari1+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [XPathResult/invalidIteratorState](https://developer.mozilla.org/en-US/docs/Web/API/XPathResult/invalidIteratorState) In all current engines. Firefox1+Safari3+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IENone Firefox for Android?iOS Safari1+Chrome for Android?Android WebView37+Samsung Internet?Opera Mobile12.1+ **✔**MDN [XPathResult/iterateNext](https://developer.mozilla.org/en-US/docs/Web/API/XPathResult/iterateNext) In all current engines. Firefox1+Safari3+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IENone Firefox for Android?iOS Safari1+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [XPathResult/numberValue](https://developer.mozilla.org/en-US/docs/Web/API/XPathResult/numberValue) In all current engines. Firefox1+Safari3+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IENone Firefox for Android?iOS Safari1+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [XPathResult/resultType](https://developer.mozilla.org/en-US/docs/Web/API/XPathResult/resultType) In all current engines. Firefox1+Safari3+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IENone Firefox for Android?iOS Safari1+Chrome for Android?Android WebView37+Samsung Internet?Opera Mobile12.1+ **✔**MDN [XPathResult/singleNodeValue](https://developer.mozilla.org/en-US/docs/Web/API/XPathResult/singleNodeValue) In all current engines. Firefox1+Safari3+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IENone Firefox for Android?iOS Safari1+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [XPathResult/snapshotItem](https://developer.mozilla.org/en-US/docs/Web/API/XPathResult/snapshotItem) In all current engines. Firefox1+Safari3+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IENone Firefox for Android?iOS Safari1+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [XPathResult/snapshotLength](https://developer.mozilla.org/en-US/docs/Web/API/XPathResult/snapshotLength) In all current engines. Firefox1+Safari3+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IENone Firefox for Android?iOS Safari1+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [XPathResult/stringValue](https://developer.mozilla.org/en-US/docs/Web/API/XPathResult/stringValue) In all current engines. Firefox1+Safari3+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IENone Firefox for Android?iOS Safari1+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [XPathResult](https://developer.mozilla.org/en-US/docs/Web/API/XPathResult) In all current engines. Firefox1+Safari3+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IENone Firefox for Android?iOS Safari1+Chrome for Android?Android WebView?Samsung Internet?Opera Mobile12.1+ **✔**MDN [XSLTProcessor/XSLTProcessor](https://developer.mozilla.org/en-US/docs/Web/API/XSLTProcessor/XSLTProcessor) In all current engines. Firefox1+Safari3.1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView3+Samsung Internet?Opera Mobile12.1+ **✔**MDN [XSLTProcessor/clearParameters](https://developer.mozilla.org/en-US/docs/Web/API/XSLTProcessor/clearParameters) In all current engines. Firefox1+Safari3.1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView3+Samsung Internet?Opera Mobile12.1+ **✔**MDN [XSLTProcessor/getParameter](https://developer.mozilla.org/en-US/docs/Web/API/XSLTProcessor/getParameter) In all current engines. Firefox1+Safari3.1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView3+Samsung Internet?Opera Mobile12.1+ **✔**MDN [XSLTProcessor/importStylesheet](https://developer.mozilla.org/en-US/docs/Web/API/XSLTProcessor/importStylesheet) In all current engines. Firefox1+Safari3.1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView3+Samsung Internet?Opera Mobile12.1+ **✔**MDN [XSLTProcessor/removeParameter](https://developer.mozilla.org/en-US/docs/Web/API/XSLTProcessor/removeParameter) In all current engines. Firefox1+Safari3.1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView3+Samsung Internet?Opera Mobile12.1+ **✔**MDN [XSLTProcessor/reset](https://developer.mozilla.org/en-US/docs/Web/API/XSLTProcessor/reset) In all current engines. Firefox1+Safari3.1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView3+Samsung Internet?Opera Mobile12.1+ **✔**MDN [XSLTProcessor/setParameter](https://developer.mozilla.org/en-US/docs/Web/API/XSLTProcessor/setParameter) In all current engines. Firefox1+Safari3.1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView3+Samsung Internet?Opera Mobile12.1+ **✔**MDN [XSLTProcessor/transformToDocument](https://developer.mozilla.org/en-US/docs/Web/API/XSLTProcessor/transformToDocument) In all current engines. Firefox1+Safari3.1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView3+Samsung Internet?Opera Mobile12.1+ **✔**MDN [XSLTProcessor/transformToFragment](https://developer.mozilla.org/en-US/docs/Web/API/XSLTProcessor/transformToFragment) In all current engines. Firefox1+Safari3.1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView3+Samsung Internet?Opera Mobile12.1+ **✔**MDN [XSLTProcessor](https://developer.mozilla.org/en-US/docs/Web/API/XSLTProcessor) In all current engines. Firefox1+Safari3.1+Chrome1+ Opera12.1+Edge79+ Edge (Legacy)12+IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView3+Samsung Internet?Opera Mobile12.1+ **✔**MDN [Element/slot](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/slot) In all current engines. Firefox63+Safari10+Chrome53+ Opera?Edge79+ Edge (Legacy)?IENone Firefox for Android?iOS Safari?Chrome for Android?Android WebView?Samsung Internet?Opera Mobile?