@samitouri / QOS-React-2 / commits / d1c42d2f1e

Remove addEventListener check in isEventSupported (#13435)

* Remove addEventListener check in isEventSupported All browsers we support also support addEventListener, so this check is unncessary * Remove capture argument from isEventSupported

Brandon Dail committed Aug 20, 2018 at 04:26 UTC d1c42d2f1ec706c2d6f424f30bd6ae430e665787
2 files changed +3 -4
packages/react-dom/src/events/ReactBrowserEventEmitter.js
+1 -1
@@ -146,7 +146,7 @@ export function listenTo(
146 break;
147 case TOP_CANCEL:
148 case TOP_CLOSE:
149 - if (isEventSupported(getRawEventName(dependency), true)) {
149 + if (isEventSupported(getRawEventName(dependency))) {
150 trapCapturedEvent(dependency, mountAt);
151 }
152 break;
packages/react-dom/src/events/isEventSupported.js
+2 -3
@@ -16,13 +16,12 @@ import {canUseDOM} from 'shared/ExecutionEnvironment';
16 * Borrows from Modernizr.
17 *
18 * @param {string} eventNameSuffix Event name, e.g. "click".
19 - * @param {?boolean} capture Check if the capture phase is supported.
19 * @return {boolean} True if the event is supported.
20 * @internal
21 * @license Modernizr 3.0.0pre (Custom Build) | MIT
22 */
24 -function isEventSupported(eventNameSuffix, capture) {
25 - if (!canUseDOM || (capture && !('addEventListener' in document))) {
23 +function isEventSupported(eventNameSuffix) {
24 + if (!canUseDOM) {
25 return false;
26 }
27