* 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)
| 3853 | * @license Modernizr 3.0.0pre (Custom Build) | MIT |
| 3854 | */ |
| 3855 | function 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 | |
| 3872 | function isCheckable(elem) { |
| 3873 | var type = elem.type; |