Skip to content

Commit

Permalink
events: deal with no arguments case
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Gruenbaum authored and Benjamin Gruenbaum committed May 31, 2020
1 parent 2935f72 commit 0a2edb5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/internal/event_target.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class Event {
this.#cancelable = !!cancelable;
this.#bubbles = !!bubbles;
this.#composed = !!composed;
this.#type = String(type);
this.#type = '' + type;
// isTrusted is special (LegacyUnforgeable)
Object.defineProperty(this, 'isTrusted', {
get() { return false; },
Expand Down
1 change: 1 addition & 0 deletions test/parallel/test-eventtarget.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ ok(EventTarget);

ev.preventDefault();
strictEqual(ev.defaultPrevented, true);
throws(() => new Event(Symbol()), TypeError);
}
{
const ev = new Event('foo');
Expand Down

0 comments on commit 0a2edb5

Please sign in to comment.