1. Infrastructure
This specification depends on the Infra Standard. [INFRA]
Some of the terms used in this specification are defined in Encoding, Selectors, Web IDL, XML, and Namespaces in XML. [ENCODING] [SELECTORS4] [WEBIDL] [XML] [XML-NAMES]
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 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:
-
Let inputTokens be the result of splitting input on ASCII whitespace.
-
Let tokens be a new ordered set.
- Return tokens.
The ordered set serializer takes a set and returns the concatenation of set using U+0020 SPACE.
1.3. Selectors
To scope-match a selectors string selectors against a node, run these steps:
-
Let s be the result of parse a selector selectors. [SELECTORS4]
-
If s is failure, then throw a "
SyntaxError
"DOMException
. -
Return the result of match a selector against a tree with s and node’s root using scoping root node. [SELECTORS4].
Support for namespaces within selectors is not planned and will not be added.
1.4. Name validation
A string is a valid namespace prefix if its length is at least 1 and it does not contain ASCII whitespace, U+0000 NULL, U+002F (/), or U+003E (>).
A string is a valid attribute local name if its length is at least 1 and it does not contain ASCII whitespace, U+0000 NULL, U+002F (/), U+003D (=), or U+003E (>).
A string name is a valid element local name if the following steps return true:
-
If name’s length is 0, then return false.
-
If name’s 0th code point is an ASCII alpha, then:
-
If name contains ASCII whitespace, U+0000 NULL, U+002F (/), or U+003E (>), then return false.
-
Return true.
-
-
If name’s 0th code point is not U+003A (:), U+005F (_), or in the range U+0080 to U+10FFFF, inclusive, then return false.
-
If name’s subsequent code points, if any, are not ASCII alphas, ASCII digits, U+002D (-), U+002E (.), U+003A (:), U+005F (_), or in the range U+0080 to U+10FFFF, inclusive, then return false.
-
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 is an 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 is a valid doctype name if it does not contain 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:
-
If namespace is the empty string, then set it to null.
-
Let prefix be null.
-
Let localName be qualifiedName.
-
If qualifiedName contains a U+003A (:):
-
Let splitResult be the result of running strictly split given qualifiedName and U+003A (:).
-
Set prefix to splitResult[0].
-
Set localName to splitResult[1].
-
If prefix is not a valid namespace prefix, then throw an "
InvalidCharacterError
"DOMException
.
-
-
Assert: prefix is either null or a valid namespace prefix.
-
If context is "
attribute
" and localName is not a valid attribute local name, then throw an "InvalidCharacterError
"DOMException
. -
If context is "
element
" and localName is not a valid element local name, then throw an "InvalidCharacterError
"DOMException
. -
If prefix is non-null and namespace is null, then throw a "
NamespaceError
"DOMException
. -
If prefix is "
xml
" and namespace is not the XML namespace, then throw a "NamespaceError
"DOMException
. -
If either qualifiedName or prefix is "
xmlns
" and namespace is not the XMLNS namespace, then throw a "NamespaceError
"DOMException
. -
If namespace is the XMLNS namespace and neither qualifiedName nor prefix is "
xmlns
", then throw a "NamespaceError
"DOMException
. -
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:
<!doctype html> < html > < head > < title > Boring example</ title > </ head > < body > < p > Hello< span id = x > world</ span > !</ p > < script > function test( e) { debug( e. target, e. currentTarget, e. eventPhase) } document. addEventListener( "hey" , test, { capture: true }) document. body. addEventListener( "hey" , test) var ev= new Event( "hey" , { bubbles: true }) document. getElementById( "x" ). dispatchEvent( ev) </ script > </ body > </ html >
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 ; // legacyreadonly attribute EventTarget ?currentTarget ;sequence <EventTarget >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 ; // legacyundefined 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 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
interface and related interfaces. [TOUCH-EVENTS]
An event has an associated path. A path is a
list of structs. Each struct consists 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
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 thebubbles
andcancelable
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’scurrentTarget
. event .
eventPhase
- Returns the event’s phase, which is one of
NONE
,CAPTURING_PHASE
,AT_TARGET
, andBUBBLING_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 withpassive
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’s
target.
The srcElement
getter steps are to return
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:
-
Let composedPath be an empty list.
-
If path is empty, then return composedPath.
-
Let currentTarget be this’s
currentTarget
attribute value. -
Assert: currentTarget is an
EventTarget
object. -
Append currentTarget to composedPath.
-
Let currentTargetIndex be 0.
-
Let currentTargetHiddenSubtreeLevel be 0.
-
Let index be path’s size − 1.
-
While index is greater than or equal to 0:
-
If path[index]'s root-of-closed-tree is true, then increase currentTargetHiddenSubtreeLevel by 1.
-
If path[index]'s invocation target is currentTarget, then set currentTargetIndex to index and break.
-
If path[index]'s slot-in-closed-tree is true, then decrease currentTargetHiddenSubtreeLevel by 1.
-
Decrease index by 1.
-
-
Let currentHiddenLevel and maxHiddenLevel be currentTargetHiddenSubtreeLevel.
-
Set index to currentTargetIndex − 1.
-
While index is greater than or equal to 0:
-
If path[index]'s root-of-closed-tree is true, then increase currentHiddenLevel by 1.
-
If currentHiddenLevel is less than or equal to maxHiddenLevel, then prepend path[index]'s invocation target to composedPath.
-
If path[index]'s slot-in-closed-tree is true:
-
Decrease currentHiddenLevel by 1.
-
If currentHiddenLevel is less than maxHiddenLevel, then set maxHiddenLevel to currentHiddenLevel.
-
-
Decrease index by 1.
-
-
Set currentHiddenLevel and maxHiddenLevel to currentTargetHiddenSubtreeLevel.
-
Set index to currentTargetIndex + 1.
-
While index is less than path’s size:
-
If path[index]'s slot-in-closed-tree is true, then increase currentHiddenLevel by 1.
-
If currentHiddenLevel is less than or equal to maxHiddenLevel, then append path[index]'s invocation target to composedPath.
-
If path[index]'s root-of-closed-tree is true:
-
Decrease currentHiddenLevel by 1.
-
If currentHiddenLevel is less than maxHiddenLevel, then set maxHiddenLevel to currentHiddenLevel.
-
-
Increase index by 1.
-
-
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’s stop propagation flag.
The cancelBubble
getter steps are to return true if
this’s stop propagation flag is set; otherwise false.
The cancelBubble
setter steps are to set this’s stop propagation flag if
the given value is true; otherwise do nothing.
The stopImmediatePropagation()
method steps are to set
this’s stop propagation flag and 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’s canceled flag is set; otherwise true.
The returnValue
setter steps are to set the canceled flag with this if
the given value is false; otherwise do nothing.
The preventDefault()
method steps are to
set the canceled flag with 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’s canceled flag is set; otherwise false.
The composed
getter steps are to return true if
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()
, 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:
-
Set event’s initialized flag.
-
Unset event’s stop propagation flag, stop immediate propagation flag, and canceled flag.
-
Set event’s
isTrusted
attribute to false. -
Set event’s target to null.
-
Set event’s
type
attribute to type. -
Set event’s
bubbles
attribute to bubbles. -
Set event’s
cancelable
attribute to cancelable.
The
initEvent(type, bubbles, cancelable)
method steps are:
-
If this’s dispatch flag is set, then return.
-
Initialize 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
interface
partial interface Window { [Replaceable ]readonly attribute (Event or undefined )event ; // legacy };
Each 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’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 thedetail
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:
-
If this’s dispatch flag is set, then return.
-
Initialize this with type, bubbles, and cancelable.
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:
-
Let event be the result of running the inner event creation steps with this interface, null, now, and eventInitDict.
-
Initialize event’s
type
attribute to type. -
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 realm, run these steps:
-
If realm is not given, then set it to null.
-
Let dictionary be the result of converting 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.
-
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 ofNSEvent
objects. -
Initialize event’s
isTrusted
attribute to true. -
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:
-
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.
-
Set event’s initialized flag.
-
Initialize event’s
timeStamp
attribute to the relative high resolution coarse time given time and event’s relevant global object. -
For each member → value of dictionary, if event has an attribute whose identifier is member, then initialize that attribute to value.
-
Run the event constructing steps with event and dictionary.
-
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 or the
W3C WebApps WG 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 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
element, in response to synthetic 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
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’seventPhase
attribute value isBUBBLING_PHASE
. When false (or not present), callback will not be invoked when event’seventPhase
attribute value isCAPTURING_PHASE
. Either way, callback will be invoked if event’seventPhase
attribute value isAT_TARGET
.When set to true, options’s
passive
indicates that the callback will not cancel the event by invokingpreventDefault()
. 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’ssignal
, 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