<commit_before>part of vint;

/**
* Utility class implementing "jquery delegate" functionality.
*/
class _DelegatedEvent {
  final _eventSelector, _callback;

  _DelegatedEvent(this._eventSelector, this._callback);

  void registerOn(html.Element parent) {
    var parentCallback = createCallbackOn(parent);
    var eventList = parent.on[eventType()];
    eventList.add(parentCallback);
  }

  createCallbackOn(parent) => (event) {
    if (isTriggeredBySelector(parent, event)) {
      _callback(event);
    }
  };

  isTriggeredBySelector(parent, event) =>
    delimiter() == -1 ?
      true :
      parent.queryAll(selector()).any((el) => el == event.target);

  eventType() =>
    delimiter() == -1 ?
      _eventSelector :
      _eventSelector.substring(0, delimiter());<commit_msg>changes delegated_event to use new streams api<commit_after>part of vint;

/**
* Utility class implementing "jquery delegate" functionality.
*/
class _DelegatedEvent {
  final _eventSelector, _callback;

  _DelegatedEvent(this._eventSelector, this._callback);

  void registerOn(html.Element parent) {
    var parentCallback = createCallbackOn(parent);
    var eventList = parent.on[eventType()];
    eventList.listen(parentCallback);
  }

  createCallbackOn(parent) => (event) {
    if (isTriggeredBySelector(parent, event)) {
      _callback(event);
    }
  };

  isTriggeredBySelector(parent, event) =>
    delimiter() == -1 ?
      true :
      parent.queryAll(selector()).any((el) => el == event.target);

  eventType() =>
    delimiter() == -1 ?
      _eventSelector :
      _eventSelector.substring(0, delimiter());
{'fraction_non_alphanumeric': 0.13308457711442787, 'fraction_numerical': 0.0037313432835820895, 'mean_word_length': 3.8610271903323263, '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': '7221101', 'n_tokens_mistral': 494, 'n_tokens_neox': 485, 'n_words': 97}