summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/dom/events/event-global-set-before-handleEvent-lookup.window.js
blob: 8f934bcea97fe10a4195d18ab11066bb2c655084 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// https://dom.spec.whatwg.org/#concept-event-listener-inner-invoke (steps 8.2 - 12)
// https://webidl.spec.whatwg.org/#call-a-user-objects-operation (step 10.1)

test(() => {
  const eventTarget = new EventTarget;

  let currentEvent;
  eventTarget.addEventListener("foo", {
    get handleEvent() {
      currentEvent = window.event;
      return () => {};
    }
  });

  const event = new Event("foo");
  eventTarget.dispatchEvent(event);

  assert_equals(currentEvent, event);
}, "window.event is set before 'handleEvent' lookup");