123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275 |
- 'use strict';
- const getVendorPrefixedName = eventName => [
- `webkit${eventName}`,
- `o${eventName.toLowerCase()}`,
- eventName.toLowerCase(),
- ];
- // https://github.com/google/closure-library/blob/8782d8ba16ef2dd4a508d2081a6938f054fc60e8/closure/goog/events/eventtype.js#L44
- module.exports = new Set([
- // Mouse events
- 'click',
- 'rightclick',
- 'dblclick',
- 'auxclick',
- 'mousedown',
- 'mouseup',
- 'mouseover',
- 'mouseout',
- 'mousemove',
- 'mouseenter',
- 'mouseleave',
- // Non-existent event; will never fire. This exists as a mouse counterpart to
- // POINTERCANCEL.
- 'mousecancel',
- // Selection events.
- // https://www.w3.org/TR/selection-api/
- 'selectionchange',
- 'selectstart', // IE, Safari, Chrome
- // Wheel events
- // http://www.w3.org/TR/DOM-Level-3-Events/#events-wheelevents
- 'wheel',
- // Key events
- 'keypress',
- 'keydown',
- 'keyup',
- // Focus
- 'blur',
- 'focus',
- 'deactivate', // IE only
- 'focusin',
- 'focusout',
- // Forms
- 'change',
- 'reset',
- 'select',
- 'submit',
- 'input',
- 'propertychange', // IE only
- // Drag and drop
- 'dragstart',
- 'drag',
- 'dragenter',
- 'dragover',
- 'dragleave',
- 'drop',
- 'dragend',
- // Touch events
- // Note that other touch events exist, but we should follow the W3C list here.
- // http://www.w3.org/TR/touch-events/#list-of-touchevent-types
- 'touchstart',
- 'touchmove',
- 'touchend',
- 'touchcancel',
- // Misc
- 'beforeunload',
- 'consolemessage',
- 'contextmenu',
- 'devicechange',
- 'devicemotion',
- 'deviceorientation',
- 'DOMContentLoaded',
- 'error',
- 'help',
- 'load',
- 'losecapture',
- 'orientationchange',
- 'readystatechange',
- 'resize',
- 'scroll',
- 'unload',
- // Media events
- 'canplay',
- 'canplaythrough',
- 'durationchange',
- 'emptied',
- 'ended',
- 'loadeddata',
- 'loadedmetadata',
- 'pause',
- 'play',
- 'playing',
- 'progress',
- 'ratechange',
- 'seeked',
- 'seeking',
- 'stalled',
- 'suspend',
- 'timeupdate',
- 'volumechange',
- 'waiting',
- // Media Source Extensions events
- // https://www.w3.org/TR/media-source/#mediasource-events
- 'sourceopen',
- 'sourceended',
- 'sourceclosed',
- // https://www.w3.org/TR/media-source/#sourcebuffer-events
- 'abort',
- 'update',
- 'updatestart',
- 'updateend',
- // HTML 5 History events
- // See http://www.w3.org/TR/html5/browsers.html#event-definitions-0
- 'hashchange',
- 'pagehide',
- 'pageshow',
- 'popstate',
- // Copy and Paste
- // Support is limited. Make sure it works on your favorite browser
- // before using.
- // http://www.quirksmode.org/dom/events/cutcopypaste.html
- 'copy',
- 'paste',
- 'cut',
- 'beforecopy',
- 'beforecut',
- 'beforepaste',
- // HTML5 online/offline events.
- // http://www.w3.org/TR/offline-webapps/#related
- 'online',
- 'offline',
- // HTML 5 worker events
- 'message',
- 'connect',
- // Service Worker Events - ServiceWorkerGlobalScope context
- // See https://w3c.github.io/ServiceWorker/#execution-context-events
- // message event defined in worker events section
- 'install',
- 'activate',
- 'fetch',
- 'foreignfetch',
- 'messageerror',
- // Service Worker Events - Document context
- // See https://w3c.github.io/ServiceWorker/#document-context-events
- 'statechange',
- 'updatefound',
- 'controllerchange',
- // CSS animation events.
- ...getVendorPrefixedName('AnimationStart'),
- ...getVendorPrefixedName('AnimationEnd'),
- ...getVendorPrefixedName('AnimationIteration'),
- // CSS transition events. Based on the browser support described at:
- // https://developer.mozilla.org/en/css/css_transitions#Browser_compatibility
- ...getVendorPrefixedName('TransitionEnd'),
- // W3C Pointer Events
- // http://www.w3.org/TR/pointerevents/
- 'pointerdown',
- 'pointerup',
- 'pointercancel',
- 'pointermove',
- 'pointerover',
- 'pointerout',
- 'pointerenter',
- 'pointerleave',
- 'gotpointercapture',
- 'lostpointercapture',
- // IE specific events.
- // See http://msdn.microsoft.com/en-us/library/ie/hh772103(v=vs.85).aspx
- // these events will be supplanted in IE11.
- 'MSGestureChange',
- 'MSGestureEnd',
- 'MSGestureHold',
- 'MSGestureStart',
- 'MSGestureTap',
- 'MSGotPointerCapture',
- 'MSInertiaStart',
- 'MSLostPointerCapture',
- 'MSPointerCancel',
- 'MSPointerDown',
- 'MSPointerEnter',
- 'MSPointerHover',
- 'MSPointerLeave',
- 'MSPointerMove',
- 'MSPointerOut',
- 'MSPointerOver',
- 'MSPointerUp',
- // Native IMEs/input tools events.
- 'text',
- // The textInput event is supported in IE9+, but only in lower case. All other
- // browsers use the camel-case event name.
- 'textinput',
- 'textInput',
- 'compositionstart',
- 'compositionupdate',
- 'compositionend',
- // The beforeinput event is initially only supported in Safari. See
- // https://bugs.chromium.org/p/chromium/issues/detail?id=342670 for Chrome
- // implementation tracking.
- 'beforeinput',
- // Webview tag events
- // See https://developer.chrome.com/apps/tags/webview
- 'exit',
- 'loadabort',
- 'loadcommit',
- 'loadredirect',
- 'loadstart',
- 'loadstop',
- 'responsive',
- 'sizechanged',
- 'unresponsive',
- // HTML5 Page Visibility API. See details at
- // `goog.labs.dom.PageVisibilityMonitor`.
- 'visibilitychange',
- // LocalStorage event.
- 'storage',
- // DOM Level 2 mutation events (deprecated).
- 'DOMSubtreeModified',
- 'DOMNodeInserted',
- 'DOMNodeRemoved',
- 'DOMNodeRemovedFromDocument',
- 'DOMNodeInsertedIntoDocument',
- 'DOMAttrModified',
- 'DOMCharacterDataModified',
- // Print events.
- 'beforeprint',
- 'afterprint',
- // Web app manifest events.
- 'beforeinstallprompt',
- 'appinstalled',
- // https://github.com/facebook/react/blob/cae635054e17a6f107a39d328649137b83f25972/packages/react-dom/src/events/DOMEventNames.js#L12
- 'afterblur',
- 'beforeblur',
- 'cancel',
- 'close',
- 'dragexit',
- 'encrypted',
- 'fullscreenchange',
- 'invalid',
- 'toggle',
- // https://github.com/sindresorhus/eslint-plugin-unicorn/pull/147
- 'search',
- 'open',
- 'show',
- ]);
|