Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default 'this' to window in EventTarget #2918

Merged
merged 2 commits into from Sep 11, 2019

Conversation

@nayeemrmn
Copy link
Contributor

commented Sep 11, 2019

Fixes #2915.

Try this in a browser console:

const assertEquals = (left, right) => { if (left != right) throw new Error(`Left: ${left}, Right: ${right}`); }
const { addEventListener } = EventTarget.prototype;
let n = 1;
addEventListener("hello", () => {
  n = 2;
});
window.dispatchEvent(new Event("hello"));
assertEquals(n, 2);
@nayeemrmn nayeemrmn force-pushed the nayeemrmn:bind-event-target branch from 78fe249 to 9f666b1 Sep 11, 2019
@nayeemrmn nayeemrmn changed the title Bind an internal event target for window Bind an internal event target for window [DON'T MERGE] Sep 11, 2019
@nayeemrmn nayeemrmn force-pushed the nayeemrmn:bind-event-target branch from 3ee9e8e to aa29209 Sep 11, 2019
@nayeemrmn nayeemrmn changed the title Bind an internal event target for window [DON'T MERGE] Default 'this' to window in EventTarget Sep 11, 2019
@ry
ry approved these changes Sep 11, 2019
Copy link
Collaborator

left a comment

LGTM

@ry ry merged commit a197623 into denoland:master Sep 11, 2019
3 checks passed
3 checks passed
Travis CI - Pull Request Build Passed
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
license/cla Contributor License Agreement is signed.
Details
@nayeemrmn nayeemrmn deleted the nayeemrmn:bind-event-target branch Sep 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants
You can’t perform that action at this time.