File tree 2 files changed +12
-6
lines changed
2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -111,14 +111,14 @@ class Event {
111
111
* composed?: boolean,
112
112
* }} [options]
113
113
*/
114
- constructor ( type , options = kEmptyObject ) {
114
+ constructor ( type , options = undefined ) {
115
115
if ( arguments . length === 0 )
116
116
throw new ERR_MISSING_ARGS ( 'type' ) ;
117
- validateObject ( options , 'options' ) ;
118
- const { bubbles , cancelable , composed } = options ;
119
- this . #cancelable = ! ! cancelable ;
120
- this . #bubbles = ! ! bubbles ;
121
- this . #composed = ! ! composed ;
117
+ if ( options != null )
118
+ validateObject ( options , ' options' ) ;
119
+ this . #bubbles = ! ! options ?. bubbles ;
120
+ this . #cancelable = ! ! options ?. cancelable ;
121
+ this . #composed = ! ! options ?. composed ;
122
122
123
123
this [ kType ] = `${ type } ` ;
124
124
if ( options ?. [ kTrustEvent ] ) {
Original file line number Diff line number Diff line change @@ -747,3 +747,9 @@ let asyncTest = Promise.resolve();
747
747
event . cancelBubble = true ;
748
748
strictEqual ( event . cancelBubble , true ) ;
749
749
}
750
+
751
+ {
752
+ // A null eventInitDict should not throw an error.
753
+ new Event ( '' , null ) ;
754
+ new Event ( '' , undefined ) ;
755
+ }
You can’t perform that action at this time.
0 commit comments