Re: [whatwg/dom] Standardize certain Microsoft event extensions (#334)

> I wonder if we should bother trying to get rid of BeforeUnloadEvent given that it's only purpose on top of Event is to add returnValue...

So if setting `BeforeUnloadEvent.returnValue` is [pointless in Safari, Firefox, and Chrome...](https://www.chromestatus.com/feature/5349061406228480) I don't see much of a reason for it to exist as its own interface at this point. (Note that Edge still shows script-set `returnValue` in their confirmation dialog).

Step 8 of [prompt to unload a document,](https://html.spec.whatwg.org/multipage/browsers.html#prompt-to-unload-a-document) says that `returnValue` set to the empty string is effecitvely `e.preventDefault()`, although quick testing shows that only Firefox treats `returnValue = ""` as `preventDefault()`: https://miketaylr.com/bzla/beforeunload-2.html

So...we could nuke `BeforeUnloadEvent` and treat `Event.returnValue` as follows:  

If you set `returnValue` to `false` (or the empty string for an event of type `beforeunload`), prevent the default action.
Otherwise, just set the value.

@cvrebert does that match your testing?



-- 
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/issues/334#issuecomment-279092541

Received on Friday, 10 February 2017 23:16:23 UTC