From e002d7811533e276c9927b237748c4e170f4cb10 Mon Sep 17 00:00:00 2001
From: Anne van Kesteren The {{EventTarget}} object represents the target to which an event is dispatched
@@ -996,6 +1000,7 @@ when something has occurred.
To flatten options run these steps:
+ To flatten options, run these
+steps:
Let capture and passive be false.
@@ -1064,6 +1073,21 @@ specified otherwise it returns null.
Return capture and passive.
To flatten more options, run these
+steps:
+
+ Let capture and passive be the result of flattening
+ options.
+
+ Let once be false.
+
+ If options is a dictionary and Return capture, passive, and once.
+ The
If callback is null, terminate these steps.
- Let capture and passive be the result of flattening
- options.
+ Let capture, passive, and once be the result of
+ flattening more options.
- Append an event listener to the associated list of event listeners with
- type set to type, callback set to callback, capture
- set to capture, and passive set to passive unless there already is an
- event listener in that list with the same type, callback, capture, and
- passive.
+ If context object's associated list of event listener does not contain an
+ event listener whose type is type, callback is callback,
+ capture is capture, and passive is passive, then append a new
+ event listener to it, whose type is type, callback is
+ callback, capture is capture, passive is passive,
+ and once is once.
The
@@ -1271,6 +1296,10 @@ an object with event, run these steps:
Unset event's in passive listener flag.
+ If listener's once is true, then set listener's
+ removed to true and remove it from object's associated list of
+ event listeners.
+
If event's stop immediate propagation flag is set,
return found.
diff --git a/dom.html b/dom.html
index 7e700d221..7ef3a0939 100644
--- a/dom.html
+++ b/dom.html
@@ -687,7 +687,7 @@ The Each Although callback is an
[Exposed=(Window,Worker)]
interface EventTarget {
- void addEventListener(DOMString type, EventListener? callback, optional (EventListenerOptions or boolean) options);
+ void addEventListener(DOMString type, EventListener? callback, optional (AddEventListenerOptions or boolean) options);
void removeEventListener(DOMString type, EventListener? callback, optional (EventListenerOptions or boolean) options);
boolean dispatchEvent(Event event);
};
@@ -979,6 +979,10 @@ dictionary EventListenerOptions {
boolean capture;
boolean passive;
};
+
+dictionary AddEventListenerOptions : EventListenerOptions {
+ boolean once;
+};
once
member indicates that the callback
+ will only be invoked once after which the event listener will be removed.
+
The event listener is appended to target's list of event listeners and is
not appended if it is a duplicate, i.e., having the same type, callback,
capture and passive values.
@@ -1048,7 +1056,8 @@ specified otherwise it returns null.
{{Event/preventDefault()}} method was not invoked, and false otherwise.
-
+
+
+
{{AddEventListenerOptions/once}}
is
+ present in options with value true, then set once to true.
+
+ addEventListener(type, callback, options)
method, when invoked, must run these steps:
@@ -1080,14 +1104,15 @@ method, when invoked, must run these steps:
EventTarget
[Exposed=(Window,Worker)]
interface EventTarget {
- void addEventListener(DOMString type, EventListener? callback, optional (EventListenerOptions or boolean) options);
+ void addEventListener(DOMString type, EventListener? callback, optional (AddEventListenerOptions or boolean) options);
void removeEventListener(DOMString type, EventListener? callback, optional (EventListenerOptions or boolean) options);
boolean dispatchEvent(Event event);
};
@@ -700,6 +700,10 @@
capture;
boolean passive;
};
+
+dictionary AddEventListenerOptions : EventListenerOptions {
+ boolean once;
+};
EventTarget
object represents the target to which an event is dispatched when something has occurred. EventTarget
object has an associated list of event listeners. callback (an
EventListener
)
EventListener
, as can be seen from the
@@ -730,6 +735,7 @@ 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’ passive
member indicates that the callback will not cancel the event by invoking preventDefault()
. This is used to enable
performance optimizations described in §3.7 Observing event listeners.
When set to true, options’s once
member indicates that the callback will only be invoked once after which the event listener will be removed.
The event listener is appended to target’s list of event listeners and is not appended if it is a duplicate, i.e., having the same type, callback, capture and passive values.
target . removeEventListener(type, callback [, options])
@@ -738,7 +744,8 @@ cancelable
attribute value is false or its preventDefault()
method was not invoked, and false otherwise.
- To flatten options run these steps:
+To flatten options, run these +steps:
Let capture and passive be false.
@@ -753,6 +760,19 @@Return capture and passive.
To flatten more options, run these +steps:
+Let capture and passive be the result of flattening options.
+Let once be false.
+If options is a dictionary and
is
+ present in options with value true, then set once to true. once
Return capture, passive, and once.
+The addEventListener(type, callback, options)
method, when invoked, must run these steps:
If callback is null, terminate these steps.
Let capture and passive be the result of flattening options.
+Let capture, passive, and once be the result of flattening more options.
Append an event listener to the associated list of event listeners with type set to type, callback set to callback, capture set to capture, and passive set to passive unless there already is an event listener in that list with the same type, callback, capture, and passive.
+If context object’s associated list of event listener does not contain an event listener whose type is type, callback is callback, capture is capture, and passive is passive, then append a new event listener to it, whose type is type, callback is callback, capture is capture, passive is passive, + and once is once.
The removeEventListener(type, callback, options)
method, when invoked, must, run these steps
handleEvent()
, with event as argument and event’s currentTarget
attribute value as callback this value. If this throws any exception, report the exception.
Unset event’s in passive listener flag.
+If listener’s once is true, then set listener’s removed to true and remove it from object’s associated list of event listeners.
If event’s stop immediate propagation flag is set, return found.
@@ -5125,6 +5148,7 @@