isEventSupported.js — react Source File
Architecture documentation for isEventSupported.js, a javascript file in the react codebase. 1 imports, 2 dependents.
Entity Profile
Dependency Diagram
graph LR c30b243e_ec29_69c6_2af4_f9dbe2733733["isEventSupported.js"] de79e1ff_cd82_893f_4de4_c543c7303310["ExecutionEnvironment"] c30b243e_ec29_69c6_2af4_f9dbe2733733 --> de79e1ff_cd82_893f_4de4_c543c7303310 ddc0fe5b_559e_c0f1_b50a_2b1305b3c3d7["ChangeEventPlugin.js"] ddc0fe5b_559e_c0f1_b50a_2b1305b3c3d7 --> c30b243e_ec29_69c6_2af4_f9dbe2733733 f81462d0_b06e_fbf9_f1b8_93352f59d5eb["ScrollEndEventPlugin.js"] f81462d0_b06e_fbf9_f1b8_93352f59d5eb --> c30b243e_ec29_69c6_2af4_f9dbe2733733 style c30b243e_ec29_69c6_2af4_f9dbe2733733 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import {canUseDOM} from 'shared/ExecutionEnvironment';
/**
* Checks if an event is supported in the current execution environment.
*
* NOTE: This will not work correctly for non-generic events such as `change`,
* `reset`, `load`, `error`, and `select`.
*
* Borrows from Modernizr.
*
* @param {string} eventNameSuffix Event name, e.g. "click".
* @return {boolean} True if the event is supported.
* @internal
* @license Modernizr 3.0.0pre (Custom Build) | MIT
*/
function isEventSupported(eventNameSuffix: string): boolean {
if (!canUseDOM) {
return false;
}
const eventName = 'on' + eventNameSuffix;
let isSupported = eventName in document;
if (!isSupported) {
const element = document.createElement('div');
element.setAttribute(eventName, 'return;');
isSupported = typeof (element: any)[eventName] === 'function';
}
return isSupported;
}
export default isEventSupported;
Domain
Subdomains
Functions
Dependencies
- ExecutionEnvironment
Imported By
Source
Frequently Asked Questions
What does isEventSupported.js do?
isEventSupported.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in isEventSupported.js?
isEventSupported.js defines 1 function(s): isEventSupported.
What does isEventSupported.js depend on?
isEventSupported.js imports 1 module(s): ExecutionEnvironment.
What files import isEventSupported.js?
isEventSupported.js is imported by 2 file(s): ChangeEventPlugin.js, ScrollEndEventPlugin.js.
Where is isEventSupported.js in the architecture?
isEventSupported.js is located at packages/react-dom-bindings/src/events/isEventSupported.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-dom-bindings/src/events).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free