MCPcopy Create free account
hub / github.com/microsoft/SandDance / isEventSupported

Function isEventSupported

docs/external/js/react-dom.development.js:3475–3490  ·  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. "cli

(eventNameSuffix)

Source from the content-addressed store, hash-verified

3473 */
3474
3475 function isEventSupported(eventNameSuffix) {
3476 if (!canUseDOM) {
3477 return false;
3478 }
3479
3480 var eventName = 'on' + eventNameSuffix;
3481 var isSupported = eventName in document;
3482
3483 if (!isSupported) {
3484 var element = document.createElement('div');
3485 element.setAttribute(eventName, 'return;');
3486 isSupported = typeof element[eventName] === 'function';
3487 }
3488
3489 return isSupported;
3490 }
3491
3492 /**
3493 * Summary of `DOMEventPluginSystem` event handling:

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected