<commit_before>var eventsSeparatorMatch = /[,\s]+/g;

function unnamespaceEvent(eventName){
  return eventName.split('.')[0];
}

function registerEvent(node, eventName, callback) {
  var eventCache = getData(node,'_cashEvents') || setData(node, '_cashEvents', {});
  eventCache[eventName] = eventCache[eventName] || [];
  eventCache[eventName].push(callback);
  node.addEventListener(eventName, callback);
}

function removeEvent(node, eventName, callback){
  var events = getData(node,'_cashEvents'),
      eventCache = (events && events[eventName]),
      index;

  if ( !eventCache ) { return; }

  if (callback) {
    node.removeEventListener(eventName, callback);
    index = eventCache.indexOf(callback);
    if ( index >= 0 ) { eventCache.splice( index, 1); }
  } else {
    each(eventCache, event => { node.removeEventListener(eventName, event); });
    eventCache = [];
  }
}

fn.extend({

  off(eventName, callback) {
    each( eventName.split(eventsSeparatorMatch), eventName => {
      this.each(v => removeEvent(v, unnamespaceEvent(eventName), callback) );
    });
    return this;
  },

  on(eventName, delegate, callback, runOnce) { // jshint ignore:line

    var originalCallback;

    if ( !isString(eventName) ) {
      for (var key in eventName) {
        this.on(key,delegate,eventName[key]);
      }
      return this;
    }<commit_msg>Ensuring eventCache is properly cleared<commit_after>var eventsSeparatorMatch = /[,\s]+/g;

function unnamespaceEvent(eventName){
  return eventName.split('.')[0];
}

function registerEvent(node, eventName, callback) {
  var eventCache = getData(node,'_cashEvents') || setData(node, '_cashEvents', {});
  eventCache[eventName] = eventCache[eventName] || [];
  eventCache[eventName].push(callback);
  node.addEventListener(eventName, callback);
}

function removeEvent(node, eventName, callback){
  var events = getData(node,'_cashEvents'),
      eventCache = (events && events[eventName]),
      index;

  if ( !eventCache ) { return; }

  if (callback) {
    node.removeEventListener(eventName, callback);
    index = eventCache.indexOf(callback);
    if ( index >= 0 ) { eventCache.splice( index, 1); }
  } else {
    each(eventCache, event => { node.removeEventListener(eventName, event); });
    delete events[eventName];
  }
}

fn.extend({

  off(eventName, callback) {
    each( eventName.split(eventsSeparatorMatch), eventName => {
      this.each(v => removeEvent(v, unnamespaceEvent(eventName), callback) );
    });
    return this;
  },

  on(eventName, delegate, callback, runOnce) { // jshint ignore:line

    var originalCallback;

    if ( !isString(eventName) ) {
      for (var key in eventName) {
        this.on(key,delegate,eventName[key]);
      }
      return this;
    }
{'fraction_non_alphanumeric': 0.14805383775918515, 'fraction_numerical': 0.0021826118588577663, 'mean_word_length': 4.0366300366300365, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '3570293', 'n_tokens_mistral': 864, 'n_tokens_neox': 844, 'n_words': 171}