File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -115,14 +115,14 @@ class Event {
115115   *   composed?: boolean, 
116116   * }} [options] 
117117   */ 
118-   constructor ( type ,  options  =  kEmptyObject )  { 
118+   constructor ( type ,  options  =  undefined )  { 
119119    if  ( arguments . length  ===  0 ) 
120120      throw  new  ERR_MISSING_ARGS ( 'type' ) ; 
121-     validateObject ( options ,   'options' ) ; 
122-     const   {  bubbles ,  cancelable ,  composed  }   =   options ; 
123-     this . #cancelable  =  ! ! cancelable ; 
124-     this . #bubbles  =  ! ! bubbles ; 
125-     this . #composed =  ! ! composed ; 
121+     if   ( options   !=   null ) 
122+        validateObject ( options ,   ' options' ) ; 
123+     this . #bubbles  =  ! ! options ?. bubbles ; 
124+     this . #cancelable  =  ! ! options ?. cancelable ; 
125+     this . #composed =  ! ! options ?. composed ; 
126126
127127    this [ kType ]  =  `${ type }  ` ; 
128128    if  ( options ?. [ kTrustEvent ] )  { 
Original file line number Diff line number Diff line change @@ -747,3 +747,9 @@ let asyncTest = Promise.resolve();
747747  event . cancelBubble  =  true ; 
748748  strictEqual ( event . cancelBubble ,  true ) ; 
749749} 
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