@@ -737,7 +737,7 @@ inherits from the {{Event}} interface.
737
737
738
738
<dt><code><var> event</var> . {{Event/defaultPrevented}} </code>
739
739
<dd> Returns true if
740
- {{Event/preventDefault()}} was used successfully to indicate cancellation.
740
+ {{Event/preventDefault()}} was invoked successfully to indicate cancellation.
741
741
742
742
<dt><code><var> event</var> . {{Event/isTrusted}} </code>
743
743
<dd> Returns true if <var> event</var> was
@@ -822,9 +822,9 @@ method must set the <a>canceled flag</a> if the
822
822
the <a>in passive listener flag</a> is unset.
823
823
824
824
<p class="note no-backref">
825
- User agents are encouraged to generate a console warning or other debugging
826
- aid to help authors identify places where calls to {{preventDefault()}}
827
- have no effect.
825
+ This means there are scenarios where invoking {{preventDefault()}} has no effect.
826
+ User agents are encouraged to log the precise cause in a developer console,
827
+ to aid debugging
828
828
</p>
829
829
830
830
The
@@ -1017,7 +1017,7 @@ seen from the definition above, an <a>event listener</a> is a more broad concept
1017
1017
is <var> type</var> . The <var> callback</var> argument sets the <b> callback</b> that will
1018
1018
be invoked when the <a>event</a> is <a>dispatched</a> .
1019
1019
1020
- The <var> options</var> argument sets listener-specific options. For compatibility this can be
1020
+ The <var> options</var> argument sets listener-specific options. For compatibility this can be
1021
1021
just a boolean, in which case the method behaves exactly as if the value was
1022
1022
specified as <var> options</var> ' <code> capture</code> member.
1023
1023
@@ -1049,13 +1049,9 @@ seen from the definition above, an <a>event listener</a> is a more broad concept
1049
1049
{{Event/preventDefault()}} method was not invoked, and false otherwise.
1050
1050
</dl>
1051
1051
1052
- <p> The
1053
- <dfn method for=EventTarget><code>addEventListener(<var>type</var>, <var>callback</var>, <var>options</var>)</code></dfn>
1054
- method, when invoked, must run these steps:
1052
+ <p> To <dfn export for=Event id=concept-normalize-options>normalize</dfn> <var> options</var> run these steps:
1055
1053
1056
1054
<ol>
1057
- <li><p> If <var> callback</var> is null, terminate these steps.
1058
-
1059
1055
<li> Let <var> capture</var> and <var> passive</var> be false.
1060
1056
1061
1057
<li> If <var> options</var> is a boolean, set <var> capture</var> to
@@ -1067,6 +1063,18 @@ method, when invoked, must run these steps:
1067
1063
<li> If <var> options</var> is a dictionary and <code> {{EventListenerOptions/passive}} </code> is
1068
1064
present in <var> options</var> with value true, then set <var> passive</var> to true.
1069
1065
1066
+ <li> Return <var> capture</var> and <var> passive</var> .
1067
+ </ol>
1068
+
1069
+ <p> The
1070
+ <dfn method for=EventTarget><code>addEventListener(<var>type</var>, <var>callback</var>, <var>options</var>)</code></dfn>
1071
+ method, when invoked, must run these steps:
1072
+
1073
+ <ol>
1074
+ <li><p> If <var> callback</var> is null, terminate these steps.
1075
+
1076
+ <li> Let <var> capture</var> and <var> passive</var> be the result of <a>normalizing</a> <var> options</var> .
1077
+
1070
1078
<li><p> Append an <a>event listener</a> to the associated list of <a>event listeners</a> with
1071
1079
<b> type</b> set to <var> type</var> , <b> callback</b> set to <var> callback</var> , <b> capture</b>
1072
1080
set to <var> capture</var> , and <b> passive</b> set to <var> passive</var> unless there
@@ -1079,16 +1087,7 @@ method, when invoked, must run these steps:
1079
1087
method, when invoked, must, run these steps
1080
1088
1081
1089
<ol>
1082
- <li> Let <var> capture</var> and <var> passive</var> be false.
1083
-
1084
- <li> If <var> options</var> is a boolean, set <var> capture</var> to
1085
- <var> options</var> .
1086
-
1087
- <li> If <var> options</var> is a dictionary and <code> {{EventListenerOptions/capture}} </code> is
1088
- present in <var> options</var> with value true, then set <var> capture</var> to true.
1089
-
1090
- <li> If <var> options</var> is a dictionary and <code> {{EventListenerOptions/passive}} </code> is
1091
- present in <var> options</var> with value true, then set <var> passive</var> to true.
1090
+ <li> Let <var> capture</var> and <var> passive</var> be the result of <a>normalizing</a> <var> options</var> .
1092
1091
1093
1092
<li> If there is an <a>event listener</a> in the associated list of
1094
1093
<a>event listeners</a> whose <b> type</b> is <var> type</var> , <b> callback</b> is <var> callback</var> ,
@@ -1113,25 +1112,25 @@ invoked, must run these steps:
1113
1112
<h3 id=observing-event-listeners>Observing event listeners</h3>
1114
1113
1115
1114
<p> In general, developers do not expect the presence of an <a>event listener</a> to be
1116
- observable. The impact of an <a>event listener</a> is determined by its <b> callback</b> .
1115
+ observable. The impact of an <a>event listener</a> is determined by its <b> callback</b> .
1117
1116
That is, a developer adding a no-op <a>event listener</a> would not expect it to have
1118
1117
any side effects.
1119
1118
1120
1119
<p> Unfortunately, some event APIs have been designed such that implementing them
1121
- efficiently requires observing <a>event listeners</a> . This can make the presence
1120
+ efficiently requires observing <a>event listeners</a> . This can make the presence
1122
1121
of listeners observable in that even empty listeners can have a dramatic performance impact
1123
1122
on the behavior of the application. For example, touch and wheel events which can be used to block
1124
- asynchronous scrolling. In some cases this problem can be mitigated by specifying
1123
+ asynchronous scrolling. In some cases this problem can be mitigated by specifying
1125
1124
the event to be {{Event/cancelable}} only when there is at least one
1126
- non-{{EventListenerOptions/passive}} listener. For example, non-{{EventListenerOptions/passive}}
1125
+ non-{{EventListenerOptions/passive}} listener. For example, non-{{EventListenerOptions/passive}}
1127
1126
{{TouchEvent}} listeners must block scrolling, but if all listeners are {{EventListenerOptions/passive}} then
1128
1127
scrolling can be allowed to start <a>in parallel</a> by making the {{TouchEvent}}
1129
- uncancelable (so that calls to {{Event/preventDefault()}} are ignored). So code
1128
+ uncancelable (so that calls to {{Event/preventDefault()}} are ignored). So code
1130
1129
dispatching an event is able to observe the absence of non-{{EventListenerOptions/passive}}
1131
1130
listeners, and use that to clear the {{Event/cancelable}} property of the event
1132
1131
being dispatched.
1133
1132
1134
- <p> Ideally, any new event types are defined such that they don't need this
1133
+ <p> Ideally, any new event APIs are defined such that they do not need this
1135
1134
property (use
<a href="https://lists.w3.org/Archives/Public/public-script-coord/">[email protected] </a>
1136
1135
for discussion).
1137
1136
0 commit comments