* 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)
| 2948 | * @license Modernizr 3.0.0pre (Custom Build) | MIT |
| 2949 | */ |
| 2950 | function 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 | |
| 2967 | function isCheckable(elem) { |
| 2968 | var type = elem.type; |