@@ -1150,16 +1150,13 @@ participate in a tree structure.</p>
1150
1150
and an <a>event listener</a> <var> listener</var> , run these steps:
1151
1151
1152
1152
<ol>
1153
- <li>
1154
- <p> If <var> eventTarget</var> 's <a>relevant global object</a> is a {{ServiceWorkerGlobalScope}}
1155
- object and its associated <a>service worker</a> 's <a for="service worker">script resource</a>' s
1156
- <a for="script resource">has ever been evaluated flag</a> is set, then <a>throw</a> a
1157
- <code> TypeError</code> .
1158
- [[!SERVICE-WORKERS]]
1159
-
1160
- <p class="note no-backref"> To optimize storing the event types allowed for the service worker and
1161
- to avoid non-deterministic changes to the event listeners, invocation of the method is allowed
1162
- only during the very first evaluation of the service worker script.
1153
+ <li><p> If <var> eventTarget</var> is a {{ServiceWorkerGlobalScope}} object, its
1154
+ <a for="ServiceWorkerGlobalScope">service worker</a> 's
1155
+ <a for="service worker">script resource</a> 's
1156
+ <a for="script resource">has ever been evaluated flag</a> is set, and <var> listener</var> 's
1157
+ <a for="event listener">type</a> matches the {{Event/type}} attribute value of any of the
1158
+ <a>service worker events</a> , then <a>report a warning to the console</a> that this might not give
1159
+ the expected results. [[!SERVICE-WORKERS]]
1163
1160
1164
1161
<li><p> If <var> listener</var> 's <a for="event listener">callback</a> is null, then return.
1165
1162
@@ -1189,30 +1186,35 @@ method, when invoked, must run these steps:
1189
1186
<var> once</var> .
1190
1187
</ol>
1191
1188
1192
- <p> To <dfn>remove an event listener</dfn> , given an {{EventTarget}} object <var> eventTarget</var>
1193
- and an <a>event listener</a> <var> listener</var> , set <var> listener</var> 's
1194
- <a for="event listener">removed</a> to true and <a for=list>remove</a> <var> listener</var> from
1195
- <var> eventTarget</var> 's <a for=EventTarget>event listener list</a> .
1196
- <!-- Intentionally not exported. -->
1189
+ <p> To <dfn export>remove an event listener</dfn> , given an {{EventTarget}} object
1190
+ <var> eventTarget</var> and an <a>event listener</a> <var> listener</var> , run these steps:
1191
+
1192
+ <ol>
1193
+ <li><p> If the <a>context object</a> is a {{ServiceWorkerGlobalScope}} object and its
1194
+ <a for="ServiceWorkerGlobalScope">service worker</a> 's
1195
+ <a for="service worker">set of event types to handle</a> contains <var> type</var> , then
1196
+ <a>report a warning to the console</a> that this might not give the expected results.
1197
+ [[!SERVICE-WORKERS]]
1198
+
1199
+ <li><p> Set <var> listener</var> 's <a for="event listener">removed</a> to true and
1200
+ <a for=list>remove</a> <var> listener</var> from <var> eventTarget</var> 's
1201
+ <a for=EventTarget>event listener list</a> .
1202
+ </ol>
1203
+
1204
+ <p class=note> HTML needs this to define event handlers. [[HTML]]
1197
1205
1198
1206
<p> To <dfn export>remove all event listeners</dfn> , given an {{EventTarget}} object
1199
1207
<var> eventTarget</var> , <a for=list>for each</a> <var> listener</var> of <var> eventTarget</var> 's
1200
1208
<a for=EventTarget>event listener list</a> , <a>remove an event listener</a> with
1201
1209
<var> eventTarget</var> and <var> listener</var> .
1202
1210
1203
- <p class=" note" > HTML needs this to define <code> document.open()</code> . [[HTML]]
1211
+ <p class=note> HTML needs this to define <code> document.open()</code> . [[HTML]]
1204
1212
1205
1213
<p> The
1206
1214
<dfn method for=EventTarget><code>removeEventListener(<var>type</var>, <var>callback</var>, <var>options</var>)</code></dfn>
1207
1215
method, when invoked, must run these steps:
1208
1216
1209
1217
<ol>
1210
- <li><p> If the <a>context object</a> 's <a>relevant global object</a> is a
1211
- {{ServiceWorkerGlobalScope}} object and its associated <a>service worker</a> 's
1212
- <a for="service worker">script resource</a> 's
1213
- <a for="script resource">has ever been evaluated flag</a> is set, then <a>throw</a> a
1214
- <code> TypeError</code> . [[!SERVICE-WORKERS]]
1215
-
1216
1218
<li><p> Let <var> capture</var> be the result of <a>flattening</a> <var> options</var> .
1217
1219
1218
1220
<li><p> If the <a>context object</a> 's <a for=EventTarget>event listener list</a>
0 commit comments