File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -413,6 +413,9 @@ function validateListener(listener) {
413413}
414414
415415function validateEventListenerOptions ( options ) {
416+ if ( typeof options === 'boolean' ) {
417+ options = { capture : options } ;
418+ }
416419 if ( options == null || typeof options !== 'object' )
417420 throw new ERR_INVALID_ARG_TYPE ( 'options' , 'object' , options ) ;
418421 const {
Original file line number Diff line number Diff line change @@ -152,7 +152,14 @@ ok(EventTarget);
152152 eventTarget . addEventListener ( 'foo' , ( event ) => event . preventDefault ( ) ) ;
153153 ok ( ! eventTarget . dispatchEvent ( event ) ) ;
154154}
155-
155+ {
156+ // Adding event listeners with a boolean useCapture
157+ const eventTarget = new EventTarget ( ) ;
158+ const event = new Event ( 'foo' ) ;
159+ const fn = common . mustCall ( ( event ) => strictEqual ( event . type , 'foo' ) ) ;
160+ eventTarget . addEventListener ( 'foo' , fn , false ) ;
161+ eventTarget . dispatchEvent ( event ) ;
162+ }
156163{
157164 const eventTarget = new NodeEventTarget ( ) ;
158165 strictEqual ( eventTarget . listenerCount ( 'foo' ) , 0 ) ;
You can’t perform that action at this time.
0 commit comments