# lib/goog/events/eventtype.js

    1// Copyright 2010 The Closure Library Authors. All Rights Reserved.2//3// Licensed under the Apache License, Version 2.0 (the "License");4// you may not use this file except in compliance with the License.5// You may obtain a copy of the License at6//7//      http://www.apache.org/licenses/LICENSE-2.08//9// Unless required by applicable law or agreed to in writing, software10// distributed under the License is distributed on an "AS-IS" BASIS,11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12// See the License for the specific language governing permissions and13// limitations under the License.1415/**16 * @fileoverview Event Types.17 *18 * @author arv@google.com (Erik Arvidsson)19 * @author mirkov@google.com (Mirko Visontai)20 */212223goog.provide('goog.events.EventType');2425goog.require('goog.userAgent');262728/**29 * Returns a prefixed event name for the current browser.30 * @param {string} eventName The name of the event.31 * @return {string} The prefixed event name.32 * @suppress {missingRequire|missingProvide}33 * @private34 */35goog.events.getVendorPrefixedName_ = function(eventName) {36  return goog.userAgent.WEBKIT ? 'webkit' + eventName :37      (goog.userAgent.OPERA ? 'o' + eventName.toLowerCase() :38          eventName.toLowerCase());39};404142/**43 * Constants for event names.44 * @enum {string}45 */46goog.events.EventType = {47  // Mouse events48  CLICK: 'click',49  RIGHTCLICK: 'rightclick',50  DBLCLICK: 'dblclick',51  MOUSEDOWN: 'mousedown',52  MOUSEUP: 'mouseup',53  MOUSEOVER: 'mouseover',54  MOUSEOUT: 'mouseout',55  MOUSEMOVE: 'mousemove',56  MOUSEENTER: 'mouseenter',57  MOUSELEAVE: 'mouseleave',58  // Select start is non-standard.59  // See http://msdn.microsoft.com/en-us/library/ie/ms536969(v=vs.85).aspx.60  SELECTSTART: 'selectstart', // IE, Safari, Chrome6162  // Key events63  KEYPRESS: 'keypress',64  KEYDOWN: 'keydown',65  KEYUP: 'keyup',6667  // Focus68  BLUR: 'blur',69  FOCUS: 'focus',70  DEACTIVATE: 'deactivate', // IE only71  // NOTE: The following two events are not stable in cross-browser usage.72  //     WebKit and Opera implement DOMFocusIn/Out.73  //     IE implements focusin/out.74  //     Gecko implements neither see bug at75  //     https://bugzilla.mozilla.org/show_bug.cgi?id=396927.76  // The DOM Events Level 3 Draft deprecates DOMFocusIn in favor of focusin:77  //     http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html78  // You can use FOCUS in Capture phase until implementations converge.79  FOCUSIN: goog.userAgent.IE ? 'focusin' : 'DOMFocusIn',80  FOCUSOUT: goog.userAgent.IE ? 'focusout' : 'DOMFocusOut',8182  // Forms83  CHANGE: 'change',84  SELECT: 'select',85  SUBMIT: 'submit',86  INPUT: 'input',87  PROPERTYCHANGE: 'propertychange', // IE only8889  // Drag and drop90  DRAGSTART: 'dragstart',91  DRAG: 'drag',92  DRAGENTER: 'dragenter',93  DRAGOVER: 'dragover',94  DRAGLEAVE: 'dragleave',95  DROP: 'drop',96  DRAGEND: 'dragend',9798  // WebKit touch events.99  TOUCHSTART: 'touchstart',100  TOUCHMOVE: 'touchmove',101  TOUCHEND: 'touchend',102  TOUCHCANCEL: 'touchcancel',103104  // Misc105  BEFOREUNLOAD: 'beforeunload',106  CONSOLEMESSAGE: 'consolemessage',107  CONTEXTMENU: 'contextmenu',108  DOMCONTENTLOADED: 'DOMContentLoaded',109  ERROR: 'error',110  HELP: 'help',111  LOAD: 'load',112  LOSECAPTURE: 'losecapture',113  ORIENTATIONCHANGE: 'orientationchange',114  READYSTATECHANGE: 'readystatechange',115  RESIZE: 'resize',116  SCROLL: 'scroll',117  UNLOAD: 'unload',118119  // HTML 5 History events120  // See http://www.w3.org/TR/html5/history.html#event-definitions121  HASHCHANGE: 'hashchange',122  PAGEHIDE: 'pagehide',123  PAGESHOW: 'pageshow',124  POPSTATE: 'popstate',125126  // Copy and Paste127  // Support is limited. Make sure it works on your favorite browser128  // before using.129  // http://www.quirksmode.org/dom/events/cutcopypaste.html130  COPY: 'copy',131  PASTE: 'paste',132  CUT: 'cut',133  BEFORECOPY: 'beforecopy',134  BEFORECUT: 'beforecut',135  BEFOREPASTE: 'beforepaste',136137  // HTML5 online/offline events.138  // http://www.w3.org/TR/offline-webapps/#related139  ONLINE: 'online',140  OFFLINE: 'offline',141142  // HTML 5 worker events143  MESSAGE: 'message',144  CONNECT: 'connect',145146  // CSS animation events.147  /** @suppress {missingRequire} */148  ANIMATIONSTART: goog.events.getVendorPrefixedName_('AnimationStart'),149  /** @suppress {missingRequire} */150  ANIMATIONEND: goog.events.getVendorPrefixedName_('AnimationEnd'),151  /** @suppress {missingRequire} */152  ANIMATIONITERATION: goog.events.getVendorPrefixedName_('AnimationIteration'),153154  // CSS transition events. Based on the browser support described at:155  // https://developer.mozilla.org/en/css/css_transitions#Browser_compatibility156  /** @suppress {missingRequire} */157  TRANSITIONEND: goog.events.getVendorPrefixedName_('TransitionEnd'),158159  // W3C Pointer Events160  // http://www.w3.org/TR/pointerevents/161  POINTERDOWN: 'pointerdown',162  POINTERUP: 'pointerup',163  POINTERCANCEL: 'pointercancel',164  POINTERMOVE: 'pointermove',165  POINTEROVER: 'pointerover',166  POINTEROUT: 'pointerout',167  POINTERENTER: 'pointerenter',168  POINTERLEAVE: 'pointerleave',169  GOTPOINTERCAPTURE: 'gotpointercapture',170  LOSTPOINTERCAPTURE: 'lostpointercapture',171172  // IE specific events.173  // See http://msdn.microsoft.com/en-us/library/ie/hh772103(v=vs.85).aspx174  // Note: these events will be supplanted in IE11.175  MSGESTURECHANGE: 'MSGestureChange',176  MSGESTUREEND: 'MSGestureEnd',177  MSGESTUREHOLD: 'MSGestureHold',178  MSGESTURESTART: 'MSGestureStart',179  MSGESTURETAP: 'MSGestureTap',180  MSGOTPOINTERCAPTURE: 'MSGotPointerCapture',181  MSINERTIASTART: 'MSInertiaStart',182  MSLOSTPOINTERCAPTURE: 'MSLostPointerCapture',183  MSPOINTERCANCEL: 'MSPointerCancel',184  MSPOINTERDOWN: 'MSPointerDown',185  MSPOINTERENTER: 'MSPointerEnter',186  MSPOINTERHOVER: 'MSPointerHover',187  MSPOINTERLEAVE: 'MSPointerLeave',188  MSPOINTERMOVE: 'MSPointerMove',189  MSPOINTEROUT: 'MSPointerOut',190  MSPOINTEROVER: 'MSPointerOver',191  MSPOINTERUP: 'MSPointerUp',192193  // Native IMEs/input tools events.194  TEXTINPUT: 'textinput',195  COMPOSITIONSTART: 'compositionstart',196  COMPOSITIONUPDATE: 'compositionupdate',197  COMPOSITIONEND: 'compositionend',198199  // Webview tag events200  // See http://developer.chrome.com/dev/apps/webview_tag.html201  EXIT: 'exit',202  LOADABORT: 'loadabort',203  LOADCOMMIT: 'loadcommit',204  LOADREDIRECT: 'loadredirect',205  LOADSTART: 'loadstart',206  LOADSTOP: 'loadstop',207  RESPONSIVE: 'responsive',208  SIZECHANGED: 'sizechanged',209  UNRESPONSIVE: 'unresponsive',210211  // HTML5 Page Visibility API.  See details at212  // {@code goog.labs.dom.PageVisibilityMonitor}.213  VISIBILITYCHANGE: 'visibilitychange',214215  // LocalStorage event.216  STORAGE: 'storage',217218  // DOM Level 2 mutation events (deprecated).219  DOMSUBTREEMODIFIED: 'DOMSubtreeModified',220  DOMNODEINSERTED: 'DOMNodeInserted',221  DOMNODEREMOVED: 'DOMNodeRemoved',222  DOMNODEREMOVEDFROMDOCUMENT: 'DOMNodeRemovedFromDocument',223  DOMNODEINSERTEDINTODOCUMENT: 'DOMNodeInsertedIntoDocument',224  DOMATTRMODIFIED: 'DOMAttrModified',225  DOMCHARACTERDATAMODIFIED: 'DOMCharacterDataModified'226};