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

Function isEventSupported

code/composition/public/app.js:3855–3870  ·  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

3853 * @license Modernizr 3.0.0pre (Custom Build) | MIT
3854 */
3855function isEventSupported(eventNameSuffix, capture) {
3856 if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) {
3857 return false;
3858 }
3859
3860 var eventName = 'on' + eventNameSuffix;
3861 var isSupported = eventName in document;
3862
3863 if (!isSupported) {
3864 var element = document.createElement('div');
3865 element.setAttribute(eventName, 'return;');
3866 isSupported = typeof element[eventName] === 'function';
3867 }
3868
3869 return isSupported;
3870}
3871
3872function isCheckable(elem) {
3873 var type = elem.type;

Callers 2

app.jsFile · 0.70
listenToFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected