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

Previously: https://www.w3.org/Bugs/Public/show_bug.cgi?id=20713 & https://www.w3.org/Bugs/Public/show_bug.cgi?id=25002.

`event.srcElement`: this is simply an alias to `event.target`.

`event.returnValue`: also relatively simple, although `BeforeUnloadEvent` will have to override it or maybe remove its variant:
```
bool legacyReturnValue() const { return !defaultPrevented(); }
void setLegacyReturnValue(bool returnValue) { setDefaultPrevented(!returnValue); }
```

`window.event`: I'm not entirely sure how this works. E.g.,
```js
var d = document.implementation.createHTMLDocument("x")
var x = d.createElement("x")
x.onclick = e => w(window.event)
x.click()
```
in Live DOM viewer still ends up logging an event. I guess we're just associating the event with the [current global object](https://html.spec.whatwg.org/#current-global-object) for the duration of dispatch? IDL can be `[Replaceable] readonly attribute any event;` as it needs to return undefined by default.

**Constants**: @foolip mentions there might be some more extensions that only Gecko does not implement.

I'm raising this in part because @miketaylr told me Gecko was leaning towards implementing these due to some compatibility issues and in part because I wonder if `window.event` is problematic for shadow trees in that it leaks information similar to `document.currentScript` (which we patched). @smaug----? If `window.event` is problematic we should probably attempt to fix the existing implementations to make them leak the event less.

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

Received on Tuesday, 27 September 2016 13:34:45 UTC