Skip to content

Commit c4685ee

Browse files
lib: Event static properties non configurable and writable
The idl definition for Event makes the properties constants this means that they shouldn't be configurable. However, they were, and this commit fixes that. Fixes: #50417
1 parent e867c32 commit c4685ee

File tree

1 file changed

+26
-31
lines changed

1 file changed

+26
-31
lines changed

lib/internal/event_target.js

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -314,11 +314,6 @@ class Event {
314314
throw new ERR_INVALID_THIS('Event');
315315
this.#propagationStopped = true;
316316
}
317-
318-
static NONE = 0;
319-
static CAPTURING_PHASE = 1;
320-
static AT_TARGET = 2;
321-
static BUBBLING_PHASE = 3;
322317
}
323318

324319
ObjectDefineProperties(
@@ -354,32 +349,32 @@ ObjectDefineProperties(
354349
isTrusted: isTrustedDescriptor,
355350
});
356351

357-
Object.defineProperties(Event, {
358-
NONE: {
359-
writable: false,
360-
configurable: false,
361-
enumerable: true,
362-
value: 0,
363-
},
364-
CAPTURING_PHASE: {
365-
writable: false,
366-
configurable: false,
367-
enumerable: true,
368-
value: 1,
369-
},
370-
AT_TARGET: {
371-
writable: false,
372-
configurable: false,
373-
enumerable: true,
374-
value: 2,
375-
},
376-
BUBBLING_PHASE: {
377-
writable: false,
378-
configurable: false,
379-
enumerable: true,
380-
value: 3,
381-
}
382-
});
352+
Object.defineProperties(Event, {
353+
NONE: {
354+
writable: false,
355+
configurable: false,
356+
enumerable: true,
357+
value: 0,
358+
},
359+
CAPTURING_PHASE: {
360+
writable: false,
361+
configurable: false,
362+
enumerable: true,
363+
value: 1,
364+
},
365+
AT_TARGET: {
366+
writable: false,
367+
configurable: false,
368+
enumerable: true,
369+
value: 2,
370+
},
371+
BUBBLING_PHASE: {
372+
writable: false,
373+
configurable: false,
374+
enumerable: true,
375+
value: 3,
376+
}
377+
});
383378

384379
function isCustomEvent(value) {
385380
return isEvent(value) && (value?.[kDetail] !== undefined);

0 commit comments

Comments
 (0)