* 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)
| 3715 | * @license Modernizr 3.0.0pre (Custom Build) | MIT |
| 3716 | */ |
| 3717 | function 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 | |
| 3734 | function isCheckable(elem) { |
| 3735 | var type = elem.type; |