MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / isEventSupported

Function isEventSupported

code/third-party/public/app.js:2950–2965  ·  view source on GitHub ↗

* 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". * @param

(eventNameSuffix, capture)

Source from the content-addressed store, hash-verified

2948 * @license Modernizr 3.0.0pre (Custom Build) | MIT
2949 */
2950function isEventSupported(eventNameSuffix, capture) {
2951 if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) {
2952 return false;
2953 }
2954
2955 var eventName = 'on' + eventNameSuffix;
2956 var isSupported = eventName in document;
2957
2958 if (!isSupported) {
2959 var element = document.createElement('div');
2960 element.setAttribute(eventName, 'return;');
2961 isSupported = typeof element[eventName] === 'function';
2962 }
2963
2964 return isSupported;
2965}
2966
2967function isCheckable(elem) {
2968 var type = elem.type;

Callers 2

app.jsFile · 0.70
listenToFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected