diff --git a/lib/internal/event_target.js b/lib/internal/event_target.js index bf51d502b17371..1d03a91cb782c7 100644 --- a/lib/internal/event_target.js +++ b/lib/internal/event_target.js @@ -78,6 +78,13 @@ const isTrusted = ObjectGetOwnPropertyDescriptor({ } }, 'isTrusted').get; +const isTrustedDescriptor = { + __proto__: null, + configurable: false, + enumerable: true, + get: isTrusted, +}; + function isEvent(value) { return typeof value?.[kType] === 'string'; } @@ -113,12 +120,7 @@ class Event { } // isTrusted is special (LegacyUnforgeable) - ObjectDefineProperty(this, 'isTrusted', { - __proto__: null, - get: isTrusted, - enumerable: true, - configurable: false - }); + ObjectDefineProperty(this, 'isTrusted', isTrustedDescriptor); this[kTarget] = null; this[kIsBeingDispatched] = false; }