<commit_before>$ ->
  $('#new-todo').on 'click', (e) ->
    e.preventDefault()
    $('#new-todo-form').show()

  $('#new-todo-form').on 'submit', (e) ->
    e.preventDefault()

    $.post '/todos',
      description: @description.value,
      done: @done.checked
    ,
      (data) ->
        html = """
               <tr>
                 <td>#{data.description}</td>
                 <td><input type="checkbox" #{'checked' if data.done }/></td>
               </tr>
               """
        $('#todos tbody').append(html)
        $('#new-todo-form').hide()[0].reset()<commit_msg>make the event delegation testable<commit_after>$ ->
  $('body').on 'click', '#new-todo', (e) ->
    e.preventDefault()
    $('#new-todo-form').show()

  $('body').on 'submit', '#new-todo-form', (e) ->
    e.preventDefault()

    $.post '/todos',
      description: @description.value,
      done: @done.checked
    ,
      (data) ->
        html = """
               <tr>
                 <td>#{data.description}</td>
                 <td><input type="checkbox" #{'checked' if data.done }/></td>
               </tr>
               """
        $('#todos tbody').append(html)
        $('#new-todo-form').hide()[0].reset()
{'fraction_non_alphanumeric': 0.22904564315352696, 'fraction_numerical': 0.0016597510373443983, 'mean_word_length': 1.7852193995381063, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 25, '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': '7310837', 'n_tokens_mistral': 389, 'n_tokens_neox': 395, 'n_words': 65}