Re: [whatwg/dom] Change add/remove event listener behavior for service workers (#653)

jungkees commented on this pull request.



> @@ -1062,15 +1062,19 @@ and an <a>event listener</a> <var>listener</var>, run these steps:
 
 <ol>
  <li>
-  <p>If <var>eventTarget</var>'s <a>relevant global object</a> is a {{ServiceWorkerGlobalScope}}
-  object and its associated <a>service worker</a>'s <a for="service worker">script resource</a>'s
-  <a for="script resource">has ever been evaluated flag</a> is set, then <a>throw</a> a
-  <code>TypeError</code>.
-  [[!SERVICE-WORKERS]]
-
-  <p class="note no-backref">To optimize storing the event types allowed for the service worker and
-  to avoid non-deterministic changes to the event listeners, invocation of the method is allowed
-  only during the very first evaluation of the service worker script.
+  <p>If <var>listener</var> observes a <a>functional event</a>, <var>eventTarget</var> is a

DOM uses "observe" as in:
> An event listener can be used to observe a specific event

If we use _listener's type_, we might need to compare it with the event's type attribute value, which makes it something like:
> If listener's type is the type attribute value of one of the events in this list, ...

I'm fine with either, but also think that we might be able to drop this first condition entirely and just start with:
> If eventTarget is a ServiceWorkerGlobalScope object, ...

This condition basically covers the listener's type is one in the list. WDYT?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/pull/653#discussion_r305455853

Received on Friday, 19 July 2019 17:36:10 UTC