| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 695569f commit c1782ea
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -541,6 +541,9 @@ function shouldAddListener(listener) { | |||
| 541 | 541 | function validateEventListenerOptions(options) { | |
| 542 | 542 | if (typeof options === 'boolean') | |
| 543 | 543 | return { capture: options }; | |
| 544 | + | ||
| 545 | + if (options === null) | ||
| 546 | + return {}; | ||
| 544 | 547 | validateObject(options, 'options', { | |
| 545 | 548 | allowArray: true, allowFunction: true, | |
| 546 | 549 | }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -178,6 +178,15 @@ let asyncTest = Promise.resolve(); | |||
| 178 | 178 | eventTarget.dispatchEvent(event); | |
| 179 | 179 | } | |
| 180 | 180 | ||
| 181 | + { | ||
| 182 | + // The `options` argument can be `null`. | ||
| 183 | + const eventTarget = new EventTarget(); | ||
| 184 | + const event = new Event('foo'); | ||
| 185 | + const fn = common.mustCall((event) => strictEqual(event.type, 'foo')); | ||
| 186 | + eventTarget.addEventListener('foo', fn, null); | ||
| 187 | + eventTarget.dispatchEvent(event); | ||
| 188 | + } | ||
| 189 | + | ||
| 181 | 190 | { | |
| 182 | 191 | const uncaughtException = common.mustCall((err, event) => { | |
| 183 | 192 | strictEqual(err.message, 'boom'); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments