diff --git a/lib/internal/event_target.js b/lib/internal/event_target.js index b59e8392325b4f..24530b0c01ffe0 100644 --- a/lib/internal/event_target.js +++ b/lib/internal/event_target.js @@ -88,7 +88,12 @@ class Event { validateObject(options, 'options', { allowArray: true, allowFunction: true, nullable: true, }); - const { cancelable, bubbles, composed } = { ...options }; + const { + cancelable, + bubbles, + composed, + [kTrustEvent]: trustEvent, + } = { ...options }; this[kCancelable] = !!cancelable; this[kBubbles] = !!bubbles; this[kComposed] = !!composed; @@ -96,7 +101,7 @@ class Event { this[kDefaultPrevented] = false; this[kTimestamp] = lazyNow(); this[kPropagationStopped] = false; - if (options?.[kTrustEvent]) { + if (trustEvent) { isTrustedSet.add(this); }