// Copyright 2010 The Closure Library Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS-IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. /** * @fileoverview Event Types. * * @author arv@google.com (Erik Arvidsson) * @author mirkov@google.com (Mirko Visontai) */ goog.provide('goog.events.EventType'); goog.require('goog.userAgent'); /** * Constants for event names. * @enum {string} */ goog.events.EventType = { // Mouse events CLICK: 'click', DBLCLICK: 'dblclick', MOUSEDOWN: 'mousedown', MOUSEUP: 'mouseup', MOUSEOVER: 'mouseover', MOUSEOUT: 'mouseout', MOUSEMOVE: 'mousemove', SELECTSTART: 'selectstart', // IE, Safari, Chrome // Key events KEYPRESS: 'keypress', KEYDOWN: 'keydown', KEYUP: 'keyup', // Focus BLUR: 'blur', FOCUS: 'focus', DEACTIVATE: 'deactivate', // IE only // NOTE: The following two events are not stable in cross-browser usage. // WebKit and Opera implement DOMFocusIn/Out. // IE implements focusin/out. // Gecko implements neither see bug at // https://bugzilla.mozilla.org/show_bug.cgi?id=396927. // The DOM Events Level 3 Draft deprecates DOMFocusIn in favor of focusin: // http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html // You can use FOCUS in Capture phase until implementations converge. FOCUSIN: goog.userAgent.IE ? 'focusin' : 'DOMFocusIn', FOCUSOUT: goog.userAgent.IE ? 'focusout' : 'DOMFocusOut', // Forms CHANGE: 'change', SELECT: 'select', SUBMIT: 'submit', INPUT: 'input', PROPERTYCHANGE: 'propertychange', // IE only // Drag and drop DRAGSTART: 'dragstart', DRAGENTER: 'dragenter', DRAGOVER: 'dragover', DRAGLEAVE: 'dragleave', DROP: 'drop', // WebKit touch events. TOUCHSTART: 'touchstart', TOUCHMOVE: 'touchmove', TOUCHEND: 'touchend', TOUCHCANCEL: 'touchcancel', // Misc CONTEXTMENU: 'contextmenu', ERROR: 'error', HELP: 'help', LOAD: 'load', LOSECAPTURE: 'losecapture', READYSTATECHANGE: 'readystatechange', RESIZE: 'resize', SCROLL: 'scroll', UNLOAD: 'unload', // HTML 5 History events // See http://www.w3.org/TR/html5/history.html#event-definitions HASHCHANGE: 'hashchange', PAGEHIDE: 'pagehide', PAGESHOW: 'pageshow', POPSTATE: '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: 'copy', PASTE: 'paste', CUT: 'cut', BEFORECOPY: 'beforecopy', BEFORECUT: 'beforecut', BEFOREPASTE: 'beforepaste', // HTML5 online/offline events. // http://www.w3.org/TR/offline-webapps/#related ONLINE: 'online', OFFLINE: 'offline', // HTML 5 worker events MESSAGE: 'message', CONNECT: 'connect', // CSS transition events. Based on the browser support described at: // https://developer.mozilla.org/en/css/css_transitions#Browser_compatibility TRANSITIONEND: goog.userAgent.WEBKIT ? 'webkitTransitionEnd' : (goog.userAgent.OPERA ? 'oTransitionEnd' : 'transitionend') };