@@ -35,7 +35,11 @@ const {
35
35
} = require ( 'internal/errors' ) ;
36
36
const { validateObject, validateString } = require ( 'internal/validators' ) ;
37
37
38
- const { customInspectSymbol, kEnumerableProperty } = require ( 'internal/util' ) ;
38
+ const {
39
+ customInspectSymbol,
40
+ kEmptyObject,
41
+ kEnumerableProperty,
42
+ } = require ( 'internal/util' ) ;
39
43
const { inspect } = require ( 'util' ) ;
40
44
41
45
const kIsEventTarget = SymbolFor ( 'nodejs.event_target' ) ;
@@ -453,7 +457,7 @@ class EventTarget {
453
457
* signal?: AbortSignal
454
458
* }} [options]
455
459
*/
456
- addEventListener ( type , listener , options = { } ) {
460
+ addEventListener ( type , listener , options = kEmptyObject ) {
457
461
if ( ! isEventTarget ( this ) )
458
462
throw new ERR_INVALID_THIS ( 'EventTarget' ) ;
459
463
if ( arguments . length < 2 )
@@ -540,7 +544,7 @@ class EventTarget {
540
544
* capture?: boolean,
541
545
* }} [options]
542
546
*/
543
- removeEventListener ( type , listener , options = { } ) {
547
+ removeEventListener ( type , listener , options = kEmptyObject ) {
544
548
if ( ! isEventTarget ( this ) )
545
549
throw new ERR_INVALID_THIS ( 'EventTarget' ) ;
546
550
if ( ! shouldAddListener ( listener ) )
@@ -869,7 +873,7 @@ function validateEventListenerOptions(options) {
869
873
return { capture : options } ;
870
874
871
875
if ( options === null )
872
- return { } ;
876
+ return kEmptyObject ;
873
877
validateObject ( options , 'options' , {
874
878
allowArray : true , allowFunction : true ,
875
879
} ) ;
0 commit comments