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

Function isEventSupported

code/styling/public/app.js:3717–3732  ·  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

3715 * @license Modernizr 3.0.0pre (Custom Build) | MIT
3716 */
3717function isEventSupported(eventNameSuffix, capture) {
3718 if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) {
3719 return false;
3720 }
3721
3722 var eventName = 'on' + eventNameSuffix;
3723 var isSupported = eventName in document;
3724
3725 if (!isSupported) {
3726 var element = document.createElement('div');
3727 element.setAttribute(eventName, 'return;');
3728 isSupported = typeof element[eventName] === 'function';
3729 }
3730
3731 return isSupported;
3732}
3733
3734function isCheckable(elem) {
3735 var type = elem.type;

Callers 2

app.jsFile · 0.70
listenToFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected