Skip to content

Commit e3a2df3

Browse files
committed
Wording tweaks for annevk@ feedback
1 parent c01304d commit e3a2df3

File tree

2 files changed

+49
-60
lines changed

2 files changed

+49
-60
lines changed

dom.bs

+25-26
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ inherits from the {{Event}} interface.
737737

738738
<dt><code><var>event</var> . {{Event/defaultPrevented}}</code>
739739
<dd>Returns true if
740-
{{Event/preventDefault()}} was used successfully to indicate cancellation.
740+
{{Event/preventDefault()}} was invoked successfully to indicate cancellation.
741741

742742
<dt><code><var>event</var> . {{Event/isTrusted}}</code>
743743
<dd>Returns true if <var>event</var> was
@@ -822,9 +822,9 @@ method must set the <a>canceled flag</a> if the
822822
the <a>in passive listener flag</a> is unset.
823823

824824
<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
828828
</p>
829829

830830
The
@@ -1017,7 +1017,7 @@ seen from the definition above, an <a>event listener</a> is a more broad concept
10171017
is <var>type</var>. The <var>callback</var> argument sets the <b>callback</b> that will
10181018
be invoked when the <a>event</a> is <a>dispatched</a>.
10191019

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
10211021
just a boolean, in which case the method behaves exactly as if the value was
10221022
specified as <var>options</var>' <code>capture</code> member.
10231023

@@ -1049,13 +1049,9 @@ seen from the definition above, an <a>event listener</a> is a more broad concept
10491049
{{Event/preventDefault()}} method was not invoked, and false otherwise.
10501050
</dl>
10511051

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:
10551053

10561054
<ol>
1057-
<li><p>If <var>callback</var> is null, terminate these steps.
1058-
10591055
<li>Let <var>capture</var> and <var>passive</var> be false.
10601056

10611057
<li>If <var>options</var> is a boolean, set <var>capture</var> to
@@ -1067,6 +1063,18 @@ method, when invoked, must run these steps:
10671063
<li>If <var>options</var> is a dictionary and <code>{{EventListenerOptions/passive}}</code> is
10681064
present in <var>options</var> with value true, then set <var>passive</var> to true.
10691065

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+
10701078
<li><p>Append an <a>event listener</a> to the associated list of <a>event listeners</a> with
10711079
<b>type</b> set to <var>type</var>, <b>callback</b> set to <var>callback</var>, <b>capture</b>
10721080
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:
10791087
method, when invoked, must, run these steps
10801088

10811089
<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>.
10921091

10931092
<li>If there is an <a>event listener</a> in the associated list of
10941093
<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:
11131112
<h3 id=observing-event-listeners>Observing event listeners</h3>
11141113

11151114
<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>.
11171116
That is, a developer adding a no-op <a>event listener</a> would not expect it to have
11181117
any side effects.
11191118

11201119
<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
11221121
of listeners observable in that even empty listeners can have a dramatic performance impact
11231122
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
11251124
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}}
11271126
{{TouchEvent}} listeners must block scrolling, but if all listeners are {{EventListenerOptions/passive}} then
11281127
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
11301129
dispatching an event is able to observe the absence of non-{{EventListenerOptions/passive}}
11311130
listeners, and use that to clear the {{Event/cancelable}} property of the event
11321131
being dispatched.
11331132

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
11351134
property (use <a href="https://lists.w3.org/Archives/Public/public-script-coord/">[email protected]</a>
11361135
for discussion).
11371136

0 commit comments

Comments
 (0)