Skip to content

Commit

Permalink
events: define event handler as enumerable
Browse files Browse the repository at this point in the history
PR-URL: #35931
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Daijiro Wachi <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
  • Loading branch information
benjamingr authored and danielleadams committed Nov 9, 2020
1 parent 7a2edea commit 33e2ee5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/internal/event_target.js
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,9 @@ function defineEventHandler(emitter, name) {
emitter.addEventListener(name, value);
}
eventHandlerValue = value;
}
},
configurable: true,
enumerable: true
});
}
module.exports = {
Expand Down
7 changes: 7 additions & 0 deletions test/parallel/test-eventtarget.js
Original file line number Diff line number Diff line change
Expand Up @@ -517,3 +517,10 @@ let asyncTest = Promise.resolve();
}));
target.dispatchEvent(new Event('foo'));
}
{
const target = new EventTarget();
defineEventHandler(target, 'foo');
const descriptor = Object.getOwnPropertyDescriptor(target, 'onfoo');
strictEqual(descriptor.configurable, true);
strictEqual(descriptor.enumerable, true);
}

0 comments on commit 33e2ee5

Please sign in to comment.