<commit_before>var Individual = require("individual")
var document = require("global/document")

var addEvent = require("./add-event.js")
var listen = require("./listen.js")

var delegatorCache = Individual("__DOM_DELEGATOR_CACHE@7", {})
var allEvents = [
    "blur", "change", "click",  "contextmenu", "dblclick",
    "error","focus", "focusin", "focusout", "keydown",
    "keypress", "keyup", "load", "mousedown", "mouseup",
    "resize", "scroll", "select", "submit", "unload",
]

module.exports = Delegator

function Delegator(opts) {
    opts = opts || {}
    var delegator = delegatorCache.delegator

    if (!delegator) {
        delegator = delegatorCache.delegator =
            new DOMDelegator()
    }

    if (opts.defaultEvents !== false) {
        allEvents.forEach(function (eventName) {
            delegator.listenTo(eventName)
        })
    }

    return delegator
}

function DOMDelegator() {
    this.target = document.documentElement
    this.events = {}
}

DOMDelegator.prototype.addEventListener = addEvent

DOMDelegator.prototype.listenTo = listenTo

function listenTo(eventName) {
    if (this.events[eventName]) {
        return
    }

    this.events[eventName] = true
    listen(this, eventName)
}
<commit_msg>support input event by default<commit_after>var Individual = require("individual")
var document = require("global/document")

var addEvent = require("./add-event.js")
var listen = require("./listen.js")

var delegatorCache = Individual("__DOM_DELEGATOR_CACHE@7", {})
var allEvents = [
    "blur", "change", "click",  "contextmenu", "dblclick",
    "error","focus", "focusin", "focusout", "input", "keydown",
    "keypress", "keyup", "load", "mousedown", "mouseup",
    "resize", "scroll", "select", "submit", "unload",
]

module.exports = Delegator

function Delegator(opts) {
    opts = opts || {}
    var delegator = delegatorCache.delegator

    if (!delegator) {
        delegator = delegatorCache.delegator =
            new DOMDelegator()
    }

    if (opts.defaultEvents !== false) {
        allEvents.forEach(function (eventName) {
            delegator.listenTo(eventName)
        })
    }

    return delegator
}

function DOMDelegator() {
    this.target = document.documentElement
    this.events = {}
}

DOMDelegator.prototype.addEventListener = addEvent

DOMDelegator.prototype.listenTo = listenTo

function listenTo(eventName) {
    if (this.events[eventName]) {
        return
    }

    this.events[eventName] = true
    listen(this, eventName)
}

{'fraction_non_alphanumeric': 0.14416932907348243, 'fraction_numerical': 0.0007987220447284345, 'mean_word_length': 3.5216606498194944, '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': '543831', 'n_tokens_mistral': 794, 'n_tokens_neox': 789, 'n_words': 159}