<commit_before>module.exports = function () {
  var _ = require('lodash'),
    dom = require('../services/dom'),
    focus = require('../decorators/focus'),
    select = require('../services/select'),
    references = require('../services/references');

  /**
   * constructor
   * @param  {Element} el
   * @param  {string} ref   component ref
   * @param  {string} path  dot-delineated path to the data
   * @param  {Element} [oldEl] hold a reference to the old element for inline forms
   */
  function constructor(el, ref, path, oldEl) {
    function outsideClickhandler(e) {
      if (!_.contains(e.path, el)) {
        el.dispatchEvent(new CustomEvent('close'));
        this.removeEventListener('click', outsideClickhandler); // note: this references <html>
      }
    }

    // if this is an inline form, add an event handler that will close the form when you click out of it
    if (oldEl) {
      dom.find('html').addEventListener('click', outsideClickhandler);

      // also set the height of the component bar
      select.setHeight(dom.closest(oldEl, '[' + references.referenceAttribute + ']'));
    }

    this.ref = ref;
    this.path = path;
    this.form = dom.find(el, 'form');
    this.form.setAttribute('data-form-ref', ref);
  }

  constructor.prototype = {
    events: {
      submit: 'closeForm',
      close: 'closeForm'
    },

    closeForm: function (e) {
      e.preventDefault();
      focus.unfocus();
    }
  };

  return constructor;
};<commit_msg>no data-form-ref<commit_after>module.exports = function () {
  var _ = require('lodash'),
    dom = require('../services/dom'),
    focus = require('../decorators/focus'),
    select = require('../services/select'),
    references = require('../services/references');

  /**
   * constructor
   * @param  {Element} el
   * @param  {string} ref   component ref
   * @param  {string} path  dot-delineated path to the data
   * @param  {Element} [oldEl] hold a reference to the old element for inline forms
   */
  function constructor(el, ref, path, oldEl) {
    function outsideClickhandler(e) {
      if (!_.contains(e.path, el)) {
        el.dispatchEvent(new CustomEvent('close'));
        this.removeEventListener('click', outsideClickhandler); // note: this references <html>
      }
    }

    // if this is an inline form, add an event handler that will close the form when you click out of it
    if (oldEl) {
      dom.find('html').addEventListener('click', outsideClickhandler);

      // also set the height of the component bar
      select.setHeight(dom.closest(oldEl, '[' + references.referenceAttribute + ']'));
    }

    this.ref = ref;
    this.path = path;
    this.form = dom.find(el, 'form');
  }

  constructor.prototype = {
    events: {
      submit: 'closeForm',
      close: 'closeForm'
    },

    closeForm: function (e) {
      e.preventDefault();
      focus.unfocus();
    }
  };

  return constructor;
};
{'fraction_non_alphanumeric': 0.14466918066506684, 'fraction_numerical': 0.0, 'mean_word_length': 2.7896103896103894, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6569431', 'n_tokens_mistral': 870, 'n_tokens_neox': 858, 'n_words': 233}