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 @@ -412,6 +412,9 @@ function validateListener(listener) {
412412}
413413
414414function validateEventListenerOptions ( options ) {
415+ if ( typeof options === 'boolean' ) {
416+ options = { capture : options } ;
417+ }
415418 if ( options == null || typeof options !== 'object' )
416419 throw new ERR_INVALID_ARG_TYPE ( 'options' , 'object' , options ) ;
417420 const {
Original file line number Diff line number Diff line change @@ -151,7 +151,14 @@ const ev = new Event('foo');
151151 eventTarget . addEventListener ( 'foo' , ( event ) => event . preventDefault ( ) ) ;
152152 ok ( ! eventTarget . dispatchEvent ( event ) ) ;
153153}
154-
154+ {
155+ // Adding event listeners with a boolean useCapture
156+ const eventTarget = new EventTarget ( ) ;
157+ const event = new Event ( 'foo' ) ;
158+ const fn = common . mustCall ( ( event ) => strictEqual ( event . type , 'foo' ) ) ;
159+ eventTarget . addEventListener ( 'foo' , fn , false ) ;
160+ eventTarget . dispatchEvent ( event ) ;
161+ }
155162{
156163 const eventTarget = new NodeEventTarget ( ) ;
157164 strictEqual ( eventTarget . listenerCount ( 'foo' ) , 0 ) ;
You can’t perform that action at this time.
0 commit comments