<commit_before>/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
 * See http://svn.openlayers.org/trunk/openlayers/repository-license.txt 
 * for the full text of the license. */

/**
 *  @requires OpenLayers/Util.js
 * 
 *  @class (Not really a class, but kind of)
 * 
 */
OpenLayers.Event = {

    /** A hashtable cache of the event observers, keyed by element.id
     * 
     * @type Object
     */
    observers: false,
    
    /** @final @type int */
    KEY_BACKSPACE: 8,

    /** @final @type int */
    KEY_TAB: 9,

    /** @final @type int */
    KEY_RETURN: 13,

    /** @final @type int */
    KEY_ESC: 27,

    /** @final @type int */
    KEY_LEFT: 37,

    /** @final @type int */
    KEY_UP: 38,

    /** @final @type int */
    KEY_RIGHT: 39,

    /** @final @type int */
    KEY_DOWN: 40,

    /** @final @type int */
    KEY_DELETE: 46,


    /**
     * @param {Event} event
     * 
     * @returns The element that caused the alert
     * @type DOMElement
     */
    element: function(event) {
        return event.target || event.srcElement;
    },

    /**
     * @param {Event} event
     * 
     * @returns Whether or not the event was the result of a left click
     * @type boolean
     */
    isLeftClick: function(event) {
        return (((event.which) && (event.which == 1)) ||
                ((event.button) && (event.button == 1)));
    },

    /**
     * @param {Event} event
     * 
     * @returns
     * @type int
     */
    pointerX: function(event) {
        return event.pageX || (event.clientX +
            (document.documentElement.scrollLeft || document.body.scrollLeft));
    },

    /**
     * @param {Event} event
     * 
     * @returns
     * @type int
     */
    pointerY: function(event) {
        return event.pageY || (event.clientY +
              (document.documentElement.scrollTop || document.body.scrollTop));
    },

    /** Stops an event from propagating. If the event's 'preventDefault' 
     *   property is set, then we prevent the default browser behaviour
     *   (such as text selection, radio-button clicking, etc) from occurring
     * 
     * @param {Event} event
     */
    stop: function(event) {
        if (event.preventDefault) {
            event.preventDefault();
            event.stopPropagation();
        } else {
            event.returnValue = false;
            event.cancelBubble = true;
        }
    },

    /** 
     * @param {Event} event
     * @param {String} tagName
     * 
     * @returns The first node with the given tagName, starting from the node 
     *           the event was triggered on and traversing the DOM upwards
     * @type DOMElement<commit_msg>patch for #623 - remove unused pointerX() and pointerY() functions<commit_after>/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
 * See http://svn.openlayers.org/trunk/openlayers/repository-license.txt 
 * for the full text of the license. */

/**
 *  @requires OpenLayers/Util.js
 * 
 *  @class (Not really a class, but kind of)
 * 
 */
OpenLayers.Event = {

    /** A hashtable cache of the event observers, keyed by element.id
     * 
     * @type Object
     */
    observers: false,
    
    /** @final @type int */
    KEY_BACKSPACE: 8,

    /** @final @type int */
    KEY_TAB: 9,

    /** @final @type int */
    KEY_RETURN: 13,

    /** @final @type int */
    KEY_ESC: 27,

    /** @final @type int */
    KEY_LEFT: 37,

    /** @final @type int */
    KEY_UP: 38,

    /** @final @type int */
    KEY_RIGHT: 39,

    /** @final @type int */
    KEY_DOWN: 40,

    /** @final @type int */
    KEY_DELETE: 46,


    /**
     * @param {Event} event
     * 
     * @returns The element that caused the alert
     * @type DOMElement
     */
    element: function(event) {
        return event.target || event.srcElement;
    },

    /**
     * @param {Event} event
     * 
     * @returns Whether or not the event was the result of a left click
     * @type boolean
     */
    isLeftClick: function(event) {
        return (((event.which) && (event.which == 1)) ||
                ((event.button) && (event.button == 1)));
    },

    /** Stops an event from propagating. If the event's 'preventDefault' 
     *   property is set, then we prevent the default browser behaviour
     *   (such as text selection, radio-button clicking, etc) from occurring
     * 
     * @param {Event} event
     */
    stop: function(event) {
        if (event.preventDefault) {
            event.preventDefault();
            event.stopPropagation();
        } else {
            event.returnValue = false;
            event.cancelBubble = true;
        }
    },

    /** 
     * @param {Event} event
     * @param {String} tagName
     * 
     * @returns The first node with the given tagName, starting from the node 
     *           the event was triggered on and traversing the DOM upwards
     * @type DOMElement
{'fraction_non_alphanumeric': 0.12908463568094175, 'fraction_numerical': 0.009539273391516136, 'mean_word_length': 1.942089552238806, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3066752', 'n_tokens_mistral': 1567, 'n_tokens_neox': 1455, 'n_words': 447}