<commit_before>/**
 * 2k v 1.1 2011-09-03
 * http://aino.com
 *
 * Copyright (c) 2011, Aino
 * Licensed under the MIT license.
 *
 * --
 *
 * Usage:
 * E.bind( HTMLElement, type, callback[, capture] );
 * E.one( HTMLElement, type, callback[, capture] );
 * E.unbind( [HTMLElement][, type][, callback][, capture] );
 * E.trigger( HTMLElement, type );
 * E.hover( HTMLElement, onMouseOver, onMouseOut );
 *
 * Shorthands:
 * E.click( HTMLElement, callback ); // same as E.bind( HTMLElement, 'click', callback );
 * E.resize( window, callback );
 * E.click( HTMLElement ); // triggers a click event on HTMLElement
*/

/*global E:true */

E = (function( window ) {

    var document = window.document,

        undef,

        types = ('blur focus focusin focusout load ' +
                 'resize scroll unload click dblclick ' +
                 'mousedown mouseup mousemove mouseover mouseout ' +
                 'mouseenter mouseleave change select submit ' +
                 'keydown keypress keyup error wheel ' +
                 'abort').split(' '),

        // match types
        _reg = function( arr ) {
            var t = [],
                i = 0,
                len = arr.length;
            while( i < len ) {
                t.push( types[ arr[ i++ ]-1 ] );
            }
            return new RegExp('^(' + t.join('|') + ')$');
        },

        // collection of types that cancels/bubbles
        cancelable = _reg( [9,11,12,13,14,15,21,22,23] ),
        dontbubble = _reg( [5,8,24,26,6,2,1,16,17] ),

        // mouseenter / leave
        mouseenter = _reg( [15,17] ),
        mouseleave = _reg( [14,16] ),

        // cache ie detection
        ie = ('attachEvent' in document),

        // the events holder
        events = [],

        // holder for callbacks in IE
        bounds = [],

        // method for retrieveing or iterating through matching event objects
        _get = function(filter, each) {

            filter = filter || {};

            var evt, i, j, ret = [];

            main: for ( i=0; events[i]; i++ ) {
                evt = events[i];

                for ( j in filter ) {
                    if ( evt[ j ] !== filter[ j ] ) {
                        continue main;
                    }
                }
                if ( each ) {
                    each( i, evt );
                }
                ret.push( evt );
            }
            return ret;
        },

        // method for finding if an element contains another element
        _contains = function( outer, inner ) {
            if ( inner && outer && inner !== outer ) {
                while( inner && inner !== document.body && inner !== outer ) {
                    inner = inner.parentNode;
                }
                if ( inner === outer ) {
                    return true;
                }
            }
            return false;
        },

        // a really basic extend method
        _extend = function( obj, extend ) {
            for ( var i in extend ) {
                obj[ i ] = extend[ i ];
            }
            return obj;
        },

        _page = function( e, xy, sc ) {
            var c = 'client'+xy;
            return typeof e[c] == 'number' ? e[c] + document.body['scroll' + sc] : undef;
        },

        _normalize = function( ev ) {

            // save some native methods first
            var pd = function() {
                    ev.preventDefault.call(ev);
                };

            // now we flatclone the event into a normal object
            // to allow overwrite of read-only attributes
            // we pass some normalized props and let the native ones override if they exist
            var e = _extend({

                CAPTURING_PHASE: 1,
                AT_TARGET: 2,
                BUBBLING_PHASE: 3,

                cancelable: _reg( cancelable ).test( ev.type ),

                bubbles: !_reg( dontbubble ).test( ev.type ),

                defaultPrevented: false,

                isTrusted: true,

                timeStamp: new Date().getTime(),

                target: ( ev.target || ev.srcElement || window ),

                currentTarget: this,

                relatedTarget: (function() {

                    if ( mouseenter.test( ev.type ) ) {
                        return e.toElement;
                    } else if ( mouseleave.test( ev.type ) ) {
                        return e.fromElement;
                    }

                    return null;<commit_msg>cache regexp to increase speed<commit_after>/**
 * 2k v 1.1 2011-09-03
 * http://aino.com
 *
 * Copyright (c) 2011, Aino
 * Licensed under the MIT license.
 *
 * --
 *
 * Usage:
 * E.bind( HTMLElement, type, callback[, capture] );
 * E.one( HTMLElement, type, callback[, capture] );
 * E.unbind( [HTMLElement][, type][, callback][, capture] );
 * E.trigger( HTMLElement, type );
 * E.hover( HTMLElement, onMouseOver, onMouseOut );
 *
 * Shorthands:
 * E.click( HTMLElement, callback ); // same as E.bind( HTMLElement, 'click', callback );
 * E.resize( window, callback );
 * E.click( HTMLElement ); // triggers a click event on HTMLElement
*/

/*global E:true */

E = (function( window ) {

    var document = window.document,

        undef,

        types = ('blur focus focusin focusout load ' +
                 'resize scroll unload click dblclick ' +
                 'mousedown mouseup mousemove mouseover mouseout ' +
                 'mouseenter mouseleave change select submit ' +
                 'keydown keypress keyup error wheel ' +
                 'abort').split(' '),

        // match types
        _reg = function( arr ) {
            var t = [],
                i = 0,
                len = arr.length;
            while( i < len ) {
                t.push( types[ arr[ i++ ]-1 ] );
            }
            return new RegExp('^(' + t.join('|') + ')$');
        },

        // collection of types that cancels/bubbles
        cancelable = _reg( [9,11,12,13,14,15,21,22,23] ),
        dontbubble = _reg( [5,8,24,26,6,2,1,16,17] ),

        // mouseenter / leave
        mouseenter = _reg( [15,17] ),
        mouseleave = _reg( [14,16] ),

        // cache ie detection
        ie = ('attachEvent' in document),

        // the events holder
        events = [],

        // holder for callbacks in IE
        bounds = [],

        // method for retrieveing or iterating through matching event objects
        _get = function(filter, each) {

            filter = filter || {};

            var evt, i, j, ret = [];

            main: for ( i=0; events[i]; i++ ) {
                evt = events[i];

                for ( j in filter ) {
                    if ( evt[ j ] !== filter[ j ] ) {
                        continue main;
                    }
                }
                if ( each ) {
                    each( i, evt );
                }
                ret.push( evt );
            }
            return ret;
        },

        // method for finding if an element contains another element
        _contains = function( outer, inner ) {
            if ( inner && outer && inner !== outer ) {
                while( inner && inner !== document.body && inner !== outer ) {
                    inner = inner.parentNode;
                }
                if ( inner === outer ) {
                    return true;
                }
            }
            return false;
        },

        // a really basic extend method
        _extend = function( obj, extend ) {
            for ( var i in extend ) {
                obj[ i ] = extend[ i ];
            }
            return obj;
        },

        _page = function( e, xy, sc ) {
            var c = 'client'+xy;
            return typeof e[c] == 'number' ? e[c] + document.body['scroll' + sc] : undef;
        },

        _normalize = function( ev ) {

            // save some native methods first
            var pd = function() {
                    ev.preventDefault.call(ev);
                };

            // now we flatclone the event into a normal object
            // to allow overwrite of read-only attributes
            // we pass some normalized props and let the native ones override if they exist
            var e = _extend({

                CAPTURING_PHASE: 1,
                AT_TARGET: 2,
                BUBBLING_PHASE: 3,

                cancelable: cancelable.test( ev.type ),

                bubbles: !(dontbubble.test( ev.type )),

                defaultPrevented: false,

                isTrusted: true,

                timeStamp: new Date().getTime(),

                target: ( ev.target || ev.srcElement || window ),

                currentTarget: this,

                relatedTarget: (function() {

                    if ( mouseenter.test( ev.type ) ) {
                        return e.toElement;
                    } else if ( mouseleave.test( ev.type ) ) {
                        return e.fromElement;
                    }

                    return null;
{'fraction_non_alphanumeric': 0.11919349448590844, 'fraction_numerical': 0.013144703130221678, 'mean_word_length': 1.2838972271686593, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1897744', 'n_tokens_mistral': 2580, 'n_tokens_neox': 2389, 'n_words': 713}