Re: [w3c/ServiceWorker] Dynamic Event Handler Registration (#1156)

@jugglinmike, the goal is to allow browsers to make certain kinds of optimizations when it comes to event dispatch, i.e. running a service worker.

> I'm wondering if any thought has been given to explicitly disallowing the practice. For instance, instead of a warning, cases like these could trigger an exception.

We actually did it already in https://dom.spec.whatwg.org/#dom-eventtarget-addeventlistener step 1. But this hasn't been implemented in any browser yet as far as I know.

https://github.com/whatwg/dom/issues/371 was filed. The discussion went this optimization is important for performance vs disallowing dynamic registers isn't natural. We haven't come to a conclusion there yet.

Note that the addEventListener step 1 does it for all event targets is what I missed when added the step: https://github.com/whatwg/dom/issues/371#issuecomment-259658479. I'll definitely fix it when we make a decision there.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/issues/1156#issuecomment-305094330

Received on Wednesday, 31 May 2017 06:16:00 UTC