diff --git a/lib/internal/event_target.js b/lib/internal/event_target.js index c4d576c3eba467..660c2456cc02bc 100644 --- a/lib/internal/event_target.js +++ b/lib/internal/event_target.js @@ -349,32 +349,37 @@ ObjectDefineProperties( isTrusted: isTrustedDescriptor, }); -Object.defineProperties(Event, { - NONE: { - writable: false, - configurable: false, - enumerable: true, - value: 0, - }, - CAPTURING_PHASE: { - writable: false, - configurable: false, - enumerable: true, - value: 1, - }, - AT_TARGET: { - writable: false, - configurable: false, - enumerable: true, - value: 2, - }, - BUBBLING_PHASE: { - writable: false, - configurable: false, - enumerable: true, - value: 3, - } -}); +ObjectDefineProperties( + Event, { + NONE: { + __proto__: null, + writable: false, + configurable: false, + enumerable: true, + value: 0, + }, + CAPTURING_PHASE: { + __proto__: null, + writable: false, + configurable: false, + enumerable: true, + value: 1, + }, + AT_TARGET: { + __proto__: null, + writable: false, + configurable: false, + enumerable: true, + value: 2, + }, + BUBBLING_PHASE: { + __proto__: null, + writable: false, + configurable: false, + enumerable: true, + value: 3, + }, + }); function isCustomEvent(value) { return isEvent(value) && (value?.[kDetail] !== undefined); diff --git a/test/parallel/test-event-target.js b/test/parallel/test-event-target.js new file mode 100644 index 00000000000000..4490faeecfba6a --- /dev/null +++ b/test/parallel/test-event-target.js @@ -0,0 +1,13 @@ +'use strict'; + +require('../common'); +const assert = require('assert'); + +const props = ['NONE', 'CAPTURING_PHASE', 'AT_TARGET', 'BUBBLING_PHASE']; + +for (const prop of props) { + const desc = Object.getOwnPropertyDescriptor(Event, prop); + assert.strictEqual(desc.writable, false); + assert.strictEqual(desc.configurable, false); + assert.strictEqual(desc.enumerable, true); +} diff --git a/test/parallel/test-event.js b/test/parallel/test-event.js deleted file mode 100644 index cf27ad6995d6d7..00000000000000 --- a/test/parallel/test-event.js +++ /dev/null @@ -1,11 +0,0 @@ -'use strict'; -const assert = require('assert'); - -const props = ['NONE', 'CAPTURING_PHASE', 'AT_TARGET', 'BUBBLING_PHASE'] - -for (const prop of props) { - const desc = Object.getOwnPropertyDescriptor(Event, prop) - assert.strictEqual(desc.writable, false) - assert.strictEqual(desc.configurable, false) - assert.strictEqual(desc.enumerable, true) -} \ No newline at end of file