See https://github.com/whatwg/dom/pull/349 When creating an event, we should be using the realm of the event target, not the global object of the document in which the event was dispatched.