@@ -35,7 +35,11 @@ const {
3535} = require ( 'internal/errors' ) ;
3636const { validateObject, validateString } = require ( 'internal/validators' ) ;
3737
38- const { customInspectSymbol, kEnumerableProperty } = require ( 'internal/util' ) ;
38+ const {
39+ customInspectSymbol,
40+ kEmptyObject,
41+ kEnumerableProperty,
42+ } = require ( 'internal/util' ) ;
3943const { inspect } = require ( 'util' ) ;
4044
4145const kIsEventTarget = SymbolFor ( 'nodejs.event_target' ) ;
@@ -455,7 +459,7 @@ class EventTarget {
455459 * signal?: AbortSignal
456460 * }} [options]
457461 */
458- addEventListener ( type , listener , options = { } ) {
462+ addEventListener ( type , listener , options = kEmptyObject ) {
459463 if ( ! isEventTarget ( this ) )
460464 throw new ERR_INVALID_THIS ( 'EventTarget' ) ;
461465 if ( arguments . length < 2 )
@@ -542,7 +546,7 @@ class EventTarget {
542546 * capture?: boolean,
543547 * }} [options]
544548 */
545- removeEventListener ( type , listener , options = { } ) {
549+ removeEventListener ( type , listener , options = kEmptyObject ) {
546550 if ( ! isEventTarget ( this ) )
547551 throw new ERR_INVALID_THIS ( 'EventTarget' ) ;
548552 if ( ! shouldAddListener ( listener ) )
@@ -870,7 +874,7 @@ function validateEventListenerOptions(options) {
870874 return { capture : options } ;
871875
872876 if ( options === null )
873- return { } ;
877+ return kEmptyObject ;
874878 validateObject ( options , 'options' , {
875879 allowArray : true , allowFunction : true ,
876880 } ) ;
0 commit comments