<commit_before>/**
 * @class HUPElementer
 * @description Class to create and manipulate DOM elements
 * @constructor
 */
var HUPElementer = function() {
  this.doc = HUP.w;
  this.li = this.doc.createElement('li');
  this.ul = this.doc.createElement('ul');
  this.div = this.doc.createElement('div');
  this.span = this.doc.createElement('span');
  this.a = this.doc.createElement('a');
  this.img = this.doc.createElement('img');
  this.button = this.doc.createElement('button');
  this.GetBody();
};
HUPElementer.prototype = {
  /**
   * Creates an 'li' element
   * @return Li element
   * @type Element
   */
  Li: function() {
    return this.li.cloneNode(true);
  },
  /**
   * Creates an 'ul' element
   * @return Ul element
   * @type Element
   */
  Ul: function() {
    return this.ul.cloneNode(true);
  },
  /**
   * Creates an 'div' element
   * @return Div element
   * @type Element
   */
  Div: function() {
    return this.div.cloneNode(true);
  },
  /**
   * Creates an 'span' element
   * @return Span element
   * @type Element
   */
  Span: function() {
    return this.span.cloneNode(true);
  },
  /**
   * Creates an 'a' element
   * @return A element
   * @type Element
   */
  A: function() {
    return this.a.cloneNode(true);
  },
  /**
   * Creates an 'img' element
   * @param {String} src source of the image
   * @param {String} alt image alternate text
   * @return Img element
   * @type Element
   */
  Img: function(src, alt) {
    var img = this.img.cloneNode(true);
    img.setAttribute('src', src);
    img.setAttribute('alt', alt);
    return img;
  },
  /**
   * Creates a 'button' element
   * @return button element
   * @type Element
   */
  Button: function(title, class) {
    var button = this.button.cloneNode(true);
    button.setAttribute('title', title);
    this.AddClass(button, class);
    return button;
  },
  /**
   * Creates a specified element
   * @param {String} el type of element
   * @return Li element
   * @type Element
   */
  El: function(el) {
    return this.doc.createElement(el);
  },
  /**
   * Creates a text element
   * @return Text element
   * @type Element
   */
  Txt: function(text) {
    return this.doc.createTextNode(text);
  },
  /**
   * Adds a child element
   * @param {Element} elem addable element
   * @param {Element} parent Element, where the new element will appended
   * @return Returns the element
   * @type {Element,Null}
   */
  Add: function(elem, parent) {
    if(parent && elem) {
      parent.appendChild(elem);
      return elem;
    }
    return null;
  },
  /**
    * Inserts an element before another element
    * @param {Element} elem insertable element
    * @param {Element} before element before the new elem will inserted
    * @return Returns the elem
    * @type Element
    */
  Insert: function(elem, before) {
    before.parentNode.insertBefore(elem, before);
    return elem;
  },
  /**
    * Removes the specified element
    * @param {Element} elem removable childnode
    * @param {Element} parent
    */
  Remove: function(elem, parent) {
    if(!elem || (!elem.parentNode && !parent)) return;
    (typeof parent == 'object') ? parent.removeChild(elem) : elem.parentNode.removeChild(elem);
  },
  /**
  * Removes all childnode of the element
  * @param {Element} element
  */
  RemoveAll: function(element) {
    while(element.firstChild) {
      this.Remove(element.firstChild, element);
    }
  },
  /**<commit_msg> - no need to pass parent element when removing an element<commit_after>/**
 * @class HUPElementer
 * @description Class to create and manipulate DOM elements
 * @constructor
 */
var HUPElementer = function() {
  this.doc = HUP.w;
  this.li = this.doc.createElement('li');
  this.ul = this.doc.createElement('ul');
  this.div = this.doc.createElement('div');
  this.span = this.doc.createElement('span');
  this.a = this.doc.createElement('a');
  this.img = this.doc.createElement('img');
  this.button = this.doc.createElement('button');
  this.GetBody();
};
HUPElementer.prototype = {
  /**
   * Creates an 'li' element
   * @return Li element
   * @type Element
   */
  Li: function() {
    return this.li.cloneNode(true);
  },
  /**
   * Creates an 'ul' element
   * @return Ul element
   * @type Element
   */
  Ul: function() {
    return this.ul.cloneNode(true);
  },
  /**
   * Creates an 'div' element
   * @return Div element
   * @type Element
   */
  Div: function() {
    return this.div.cloneNode(true);
  },
  /**
   * Creates an 'span' element
   * @return Span element
   * @type Element
   */
  Span: function() {
    return this.span.cloneNode(true);
  },
  /**
   * Creates an 'a' element
   * @return A element
   * @type Element
   */
  A: function() {
    return this.a.cloneNode(true);
  },
  /**
   * Creates an 'img' element
   * @param {String} src source of the image
   * @param {String} alt image alternate text
   * @return Img element
   * @type Element
   */
  Img: function(src, alt) {
    var img = this.img.cloneNode(true);
    img.setAttribute('src', src);
    img.setAttribute('alt', alt);
    return img;
  },
  /**
   * Creates a 'button' element
   * @return button element
   * @type Element
   */
  Button: function(title, class) {
    var button = this.button.cloneNode(true);
    button.setAttribute('title', title);
    this.AddClass(button, class);
    return button;
  },
  /**
   * Creates a specified element
   * @param {String} el type of element
   * @return Li element
   * @type Element
   */
  El: function(el) {
    return this.doc.createElement(el);
  },
  /**
   * Creates a text element
   * @return Text element
   * @type Element
   */
  Txt: function(text) {
    return this.doc.createTextNode(text);
  },
  /**
   * Adds a child element
   * @param {Element} elem addable element
   * @param {Element} parent Element, where the new element will appended
   * @return Returns the element
   * @type {Element,Null}
   */
  Add: function(elem, parent) {
    if(parent && elem) {
      parent.appendChild(elem);
      return elem;
    }
    return null;
  },
  /**
    * Inserts an element before another element
    * @param {Element} elem insertable element
    * @param {Element} before element before the new elem will inserted
    * @return Returns the elem
    * @type Element
    */
  Insert: function(elem, before) {
    before.parentNode.insertBefore(elem, before);
    return elem;
  },
  /**
    * Removes the specified element
    * @param {Element} elem removable childnode
    * @param {Element} parent
    */
  Remove: function(elem, parent) {
    if(!elem || !elem.parentNode) return;
    elem.parentNode.removeChild(elem);
  },
  /**
  * Removes all childnode of the element
  * @param {Element} element
  */
  RemoveAll: function(element) {
    while(element.firstChild) {
      this.Remove(element.firstChild);
    }
  },
  /**
{'fraction_non_alphanumeric': 0.14198071866783524, 'fraction_numerical': 0.0, 'mean_word_length': 2.7954545454545454, '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': '5201480', 'n_tokens_mistral': 2162, 'n_tokens_neox': 2159, 'n_words': 588}