|
| 1 | +'use strict'; |
| 2 | + |
| 3 | +const getVendorPrefixedName = eventName => [ |
| 4 | + `webkit${eventName}`, |
| 5 | + `o${eventName.toLowerCase()}`, |
| 6 | + eventName.toLowerCase() |
| 7 | +]; |
| 8 | + |
| 9 | +// https://github.com/google/closure-library/blob/8782d8ba16ef2dd4a508d2081a6938f054fc60e8/closure/goog/events/eventtype.js#L44 |
| 10 | +module.exports = new Set([ |
| 11 | + // Mouse events |
| 12 | + 'click', |
| 13 | + 'rightclick', |
| 14 | + 'dblclick', |
| 15 | + 'auxclick', |
| 16 | + 'mousedown', |
| 17 | + 'mouseup', |
| 18 | + 'mouseover', |
| 19 | + 'mouseout', |
| 20 | + 'mousemove', |
| 21 | + 'mouseenter', |
| 22 | + 'mouseleave', |
| 23 | + |
| 24 | + // Non-existent event; will never fire. This exists as a mouse counterpart to |
| 25 | + // POINTERCANCEL. |
| 26 | + 'mousecancel', |
| 27 | + |
| 28 | + // Selection events. |
| 29 | + // https://www.w3.org/TR/selection-api/ |
| 30 | + 'selectionchange', |
| 31 | + 'selectstart', // IE, Safari, Chrome |
| 32 | + |
| 33 | + // Wheel events |
| 34 | + // http://www.w3.org/TR/DOM-Level-3-Events/#events-wheelevents |
| 35 | + 'wheel', |
| 36 | + |
| 37 | + // Key events |
| 38 | + 'keypress', |
| 39 | + 'keydown', |
| 40 | + 'keyup', |
| 41 | + |
| 42 | + // Focus |
| 43 | + 'blur', |
| 44 | + 'focus', |
| 45 | + 'deactivate', // IE only |
| 46 | + 'focusin', |
| 47 | + 'focusout', |
| 48 | + |
| 49 | + // Forms |
| 50 | + 'change', |
| 51 | + 'reset', |
| 52 | + 'select', |
| 53 | + 'submit', |
| 54 | + 'input', |
| 55 | + 'propertychange', // IE only |
| 56 | + |
| 57 | + // Drag and drop |
| 58 | + 'dragstart', |
| 59 | + 'drag', |
| 60 | + 'dragenter', |
| 61 | + 'dragover', |
| 62 | + 'dragleave', |
| 63 | + 'drop', |
| 64 | + 'dragend', |
| 65 | + |
| 66 | + // Touch events |
| 67 | + // Note that other touch events exist, but we should follow the W3C list here. |
| 68 | + // http://www.w3.org/TR/touch-events/#list-of-touchevent-types |
| 69 | + 'touchstart', |
| 70 | + 'touchmove', |
| 71 | + 'touchend', |
| 72 | + 'touchcancel', |
| 73 | + |
| 74 | + // Misc |
| 75 | + 'beforeunload', |
| 76 | + 'consolemessage', |
| 77 | + 'contextmenu', |
| 78 | + 'devicechange', |
| 79 | + 'devicemotion', |
| 80 | + 'deviceorientation', |
| 81 | + 'DOMContentLoaded', |
| 82 | + 'error', |
| 83 | + 'help', |
| 84 | + 'load', |
| 85 | + 'losecapture', |
| 86 | + 'orientationchange', |
| 87 | + 'readystatechange', |
| 88 | + 'resize', |
| 89 | + 'scroll', |
| 90 | + 'unload', |
| 91 | + |
| 92 | + // Media events |
| 93 | + 'canplay', |
| 94 | + 'canplaythrough', |
| 95 | + 'durationchange', |
| 96 | + 'emptied', |
| 97 | + 'ended', |
| 98 | + 'loadeddata', |
| 99 | + 'loadedmetadata', |
| 100 | + 'pause', |
| 101 | + 'play', |
| 102 | + 'playing', |
| 103 | + 'progress', |
| 104 | + 'ratechange', |
| 105 | + 'seeked', |
| 106 | + 'seeking', |
| 107 | + 'stalled', |
| 108 | + 'suspend', |
| 109 | + 'timeupdate', |
| 110 | + 'volumechange', |
| 111 | + 'waiting', |
| 112 | + |
| 113 | + // Media Source Extensions events |
| 114 | + // https://www.w3.org/TR/media-source/#mediasource-events |
| 115 | + 'sourceopen', |
| 116 | + 'sourceended', |
| 117 | + 'sourceclosed', |
| 118 | + // https://www.w3.org/TR/media-source/#sourcebuffer-events |
| 119 | + 'abort', |
| 120 | + 'update', |
| 121 | + 'updatestart', |
| 122 | + 'updateend', |
| 123 | + |
| 124 | + // HTML 5 History events |
| 125 | + // See http://www.w3.org/TR/html5/browsers.html#event-definitions-0 |
| 126 | + 'hashchange', |
| 127 | + 'pagehide', |
| 128 | + 'pageshow', |
| 129 | + 'popstate', |
| 130 | + |
| 131 | + // Copy and Paste |
| 132 | + // Support is limited. Make sure it works on your favorite browser |
| 133 | + // before using. |
| 134 | + // http://www.quirksmode.org/dom/events/cutcopypaste.html |
| 135 | + 'copy', |
| 136 | + 'paste', |
| 137 | + 'cut', |
| 138 | + 'beforecopy', |
| 139 | + 'beforecut', |
| 140 | + 'beforepaste', |
| 141 | + |
| 142 | + // HTML5 online/offline events. |
| 143 | + // http://www.w3.org/TR/offline-webapps/#related |
| 144 | + 'online', |
| 145 | + 'offline', |
| 146 | + |
| 147 | + // HTML 5 worker events |
| 148 | + 'message', |
| 149 | + 'connect', |
| 150 | + |
| 151 | + // Service Worker Events - ServiceWorkerGlobalScope context |
| 152 | + // See https://w3c.github.io/ServiceWorker/#execution-context-events |
| 153 | + // message event defined in worker events section |
| 154 | + 'install', |
| 155 | + 'activate', |
| 156 | + 'fetch', |
| 157 | + 'foreignfetch', |
| 158 | + 'messageerror', |
| 159 | + |
| 160 | + // Service Worker Events - Document context |
| 161 | + // See https://w3c.github.io/ServiceWorker/#document-context-events |
| 162 | + 'statechange', |
| 163 | + 'updatefound', |
| 164 | + 'controllerchange', |
| 165 | + |
| 166 | + // CSS animation events. |
| 167 | + ...getVendorPrefixedName('AnimationStart'), |
| 168 | + ...getVendorPrefixedName('AnimationEnd'), |
| 169 | + ...getVendorPrefixedName('AnimationIteration'), |
| 170 | + |
| 171 | + // CSS transition events. Based on the browser support described at: |
| 172 | + // https://developer.mozilla.org/en/css/css_transitions#Browser_compatibility |
| 173 | + ...getVendorPrefixedName('TransitionEnd'), |
| 174 | + |
| 175 | + // W3C Pointer Events |
| 176 | + // http://www.w3.org/TR/pointerevents/ |
| 177 | + 'pointerdown', |
| 178 | + 'pointerup', |
| 179 | + 'pointercancel', |
| 180 | + 'pointermove', |
| 181 | + 'pointerover', |
| 182 | + 'pointerout', |
| 183 | + 'pointerenter', |
| 184 | + 'pointerleave', |
| 185 | + 'gotpointercapture', |
| 186 | + 'lostpointercapture', |
| 187 | + |
| 188 | + // IE specific events. |
| 189 | + // See http://msdn.microsoft.com/en-us/library/ie/hh772103(v=vs.85).aspx |
| 190 | + // these events will be supplanted in IE11. |
| 191 | + 'MSGestureChange', |
| 192 | + 'MSGestureEnd', |
| 193 | + 'MSGestureHold', |
| 194 | + 'MSGestureStart', |
| 195 | + 'MSGestureTap', |
| 196 | + 'MSGotPointerCapture', |
| 197 | + 'MSInertiaStart', |
| 198 | + 'MSLostPointerCapture', |
| 199 | + 'MSPointerCancel', |
| 200 | + 'MSPointerDown', |
| 201 | + 'MSPointerEnter', |
| 202 | + 'MSPointerHover', |
| 203 | + 'MSPointerLeave', |
| 204 | + 'MSPointerMove', |
| 205 | + 'MSPointerOut', |
| 206 | + 'MSPointerOver', |
| 207 | + 'MSPointerUp', |
| 208 | + |
| 209 | + // Native IMEs/input tools events. |
| 210 | + 'text', |
| 211 | + // The textInput event is supported in IE9+, but only in lower case. All other |
| 212 | + // browsers use the camel-case event name. |
| 213 | + 'textinput', |
| 214 | + 'textInput', |
| 215 | + 'compositionstart', |
| 216 | + 'compositionupdate', |
| 217 | + 'compositionend', |
| 218 | + |
| 219 | + // The beforeinput event is initially only supported in Safari. See |
| 220 | + // https://bugs.chromium.org/p/chromium/issues/detail?id=342670 for Chrome |
| 221 | + // implementation tracking. |
| 222 | + 'beforeinput', |
| 223 | + |
| 224 | + // Webview tag events |
| 225 | + // See https://developer.chrome.com/apps/tags/webview |
| 226 | + 'exit', |
| 227 | + 'loadabort', |
| 228 | + 'loadcommit', |
| 229 | + 'loadredirect', |
| 230 | + 'loadstart', |
| 231 | + 'loadstop', |
| 232 | + 'responsive', |
| 233 | + 'sizechanged', |
| 234 | + 'unresponsive', |
| 235 | + |
| 236 | + // HTML5 Page Visibility API. See details at |
| 237 | + // `goog.labs.dom.PageVisibilityMonitor`. |
| 238 | + 'visibilitychange', |
| 239 | + |
| 240 | + // LocalStorage event. |
| 241 | + 'storage', |
| 242 | + |
| 243 | + // DOM Level 2 mutation events (deprecated). |
| 244 | + 'DOMSubtreeModified', |
| 245 | + 'DOMNodeInserted', |
| 246 | + 'DOMNodeRemoved', |
| 247 | + 'DOMNodeRemovedFromDocument', |
| 248 | + 'DOMNodeInsertedIntoDocument', |
| 249 | + 'DOMAttrModified', |
| 250 | + 'DOMCharacterDataModified', |
| 251 | + |
| 252 | + // Print events. |
| 253 | + 'beforeprint', |
| 254 | + 'afterprint', |
| 255 | + |
| 256 | + // Web app manifest events. |
| 257 | + 'beforeinstallprompt', |
| 258 | + 'appinstalled', |
| 259 | + |
| 260 | + // https://github.com/facebook/react/blob/cae635054e17a6f107a39d328649137b83f25972/packages/react-dom/src/events/DOMEventNames.js#L12 |
| 261 | + 'afterblur', |
| 262 | + 'beforeblur', |
| 263 | + 'cancel', |
| 264 | + 'close', |
| 265 | + 'dragexit', |
| 266 | + 'encrypted', |
| 267 | + 'fullscreenchange', |
| 268 | + 'invalid', |
| 269 | + 'toggle', |
| 270 | + |
| 271 | + // https://github.com/sindresorhus/eslint-plugin-unicorn/pull/147 |
| 272 | + 'search', |
| 273 | + 'open', |
| 274 | + 'show' |
| 275 | +]); |
0 commit comments