<commit_before>(function() {

  var root = this,
      Backbone = root.Backbone,
      Handlebars = root.Handlebars,
      Thorax = root.Thorax,
      _ = root._,
      $ = root.$,
      paramMatcher = /:(\w+)/g,
      callMethodAttributeName = 'data-call-method';

  Handlebars.registerHelper('url', function(url) {
    var matches = url.match(paramMatcher),
        context = this;
    if (matches) {
      url = url.replace(paramMatcher, function(match, key) {
        return context[key] ? Thorax.Util.getValue(context, key) : match;
      });
    }
    url = Thorax.Util.expandToken(url, context);
    return (Backbone.history._hasPushState ? Backbone.history.options.root : '#') + url;
  });
  
  Handlebars.registerHelper('button', function(method, options) {
    options.hash.tag = options.hash.tag || options.hash.tagName || 'button';
    options.hash[callMethodAttributeName] = method;
    return new Handlebars.SafeString(Thorax.Util.tag.call(this, options.hash, options.fn ? options.fn(this) : '', this));
  });
  
  Handlebars.registerHelper('link', function(url, options) {
    options.hash.tag = options.hash.tag || options.hash.tagName || 'a';
    options.hash.href = Handlebars.helpers.url.call(this, url);
    options.hash[callMethodAttributeName] = '_anchorClick';
    return new Handlebars.SafeString(Thorax.Util.tag.call(this, options.hash, options.fn ? options.fn(this) : '', this));
  });
  
  $(function() {
    $(document).on('click', '[' + callMethodAttributeName + ']', function(event) {
      var target = $(event.target),
          view = target.view(),<commit_msg>button should look for closest view that is not a helper<commit_after>(function() {

  var root = this,
      Backbone = root.Backbone,
      Handlebars = root.Handlebars,
      Thorax = root.Thorax,
      _ = root._,
      $ = root.$,
      paramMatcher = /:(\w+)/g,
      callMethodAttributeName = 'data-call-method';

  Handlebars.registerHelper('url', function(url) {
    var matches = url.match(paramMatcher),
        context = this;
    if (matches) {
      url = url.replace(paramMatcher, function(match, key) {
        return context[key] ? Thorax.Util.getValue(context, key) : match;
      });
    }
    url = Thorax.Util.expandToken(url, context);
    return (Backbone.history._hasPushState ? Backbone.history.options.root : '#') + url;
  });
  
  Handlebars.registerHelper('button', function(method, options) {
    options.hash.tag = options.hash.tag || options.hash.tagName || 'button';
    options.hash[callMethodAttributeName] = method;
    return new Handlebars.SafeString(Thorax.Util.tag.call(this, options.hash, options.fn ? options.fn(this) : '', this));
  });
  
  Handlebars.registerHelper('link', function(url, options) {
    options.hash.tag = options.hash.tag || options.hash.tagName || 'a';
    options.hash.href = Handlebars.helpers.url.call(this, url);
    options.hash[callMethodAttributeName] = '_anchorClick';
    return new Handlebars.SafeString(Thorax.Util.tag.call(this, options.hash, options.fn ? options.fn(this) : '', this));
  });
  
  $(function() {
    $(document).on('click', '[' + callMethodAttributeName + ']', function(event) {
      var target = $(event.target),
          view = target.view({helper: false}),
{'fraction_non_alphanumeric': 0.15927295132470734, 'fraction_numerical': 0.0, 'mean_word_length': 3.399728997289973, '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': '4785178', 'n_tokens_mistral': 1011, 'n_tokens_neox': 1010, 'n_words': 180}