<commit_before>/** @license
 *   hoe.js - [http://schettino72.github.com/hoe.js]
 *   MIT license - Copyright (c) 2012 <NAME>
 *
 * Supports IE 9+ (needs CustomEvent polyfill)
 */


/**
 * @namespace creates new DOM elements
 * @param {String} tag name of tag to be created
 * @param {Object} [attrs] set as html element attributes
 * @param {DOMElement|string} append as nodes into element
 * @returns {DOMElement}
 */
var hoe = function(tag, attrs){
    // create element
    var $ele = document.createElement(tag);

    // add attributes
    if (attrs){
        for(var name in attrs){
            $ele.setAttribute(name, attrs[name]);
        }
    }

    // add child nodes
    for(var i=2, max=arguments.length; i<max; i++){
        var param = arguments[i];
        if(param instanceof Node){
            $ele.appendChild(param);
        }
        else {
            $ele.appendChild(document.createTextNode(param));
        }
    }

    // CustomElements integration:
    // createdCallback should be called only after
    // element's content and attributes are set.
    if('createdCallback' in $ele){
        $ele.__init__();
    }
    return $ele;
};


/**
 * @param {DOMElement} $ele element that will contain append elements
 * @param {DOMElement|string} append as nodes into element
 */
hoe.append = function($ele){
    for(var i=1, max=arguments.length; i<max; i++){
        var param = arguments[i];
        if(typeof(param) === "string"){
            $ele.appendChild(document.createTextNode(param));
        }
        else {
            $ele.appendChild(param);
        }
    }
};

/**
 * Shortcut to replace content of a node
 */
hoe.html = function($ele){
    $ele.innerHTML = '';
    for(var i=1, max=arguments.length; i<max; i++){
        var param = arguments[i];
        if(typeof(param) === "string"){
            $ele.appendChild(document.createTextNode(param));
        }
        else {
            $ele.appendChild(param);
        }
    }
};


/**
 * Remove element from DOM
 */
hoe.remove = function($ele){
    if ($ele.parentNode !== null){
        $ele.parentNode.removeChild($ele);
        return true;
    }
    else {
        return false;
    }<commit_msg>hoe.append() works for numbers without explicit conversion.<commit_after>/** @license
 *   hoe.js - [http://schettino72.github.com/hoe.js]
 *   MIT license - Copyright (c) 2012 <NAME>
 *
 * Supports IE 9+ (needs CustomEvent polyfill)
 */


/**
 * @namespace creates new DOM elements
 * @param {String} tag name of tag to be created
 * @param {Object} [attrs] set as html element attributes
 * @param {DOMElement|string} append as nodes into element
 * @returns {DOMElement}
 */
var hoe = function(tag, attrs){
    // create element
    var $ele = document.createElement(tag);

    // add attributes
    if (attrs){
        for(var name in attrs){
            $ele.setAttribute(name, attrs[name]);
        }
    }

    // add child nodes
    for(var i=2, max=arguments.length; i<max; i++){
        var param = arguments[i];
        if(param instanceof Node){
            $ele.appendChild(param);
        }
        else {
            $ele.appendChild(document.createTextNode(param));
        }
    }

    // CustomElements integration:
    // createdCallback should be called only after
    // element's content and attributes are set.
    if('createdCallback' in $ele){
        $ele.__init__();
    }
    return $ele;
};


/**
 * @param {DOMElement} $ele element that will contain append elements
 * @param {DOMElement|string} append as nodes into element
 */
hoe.append = function($ele){
    for(var i=1, max=arguments.length; i<max; i++){
        var param = arguments[i];
        if(param instanceof Node){
            $ele.appendChild(param);
        }
        else {
            $ele.appendChild(document.createTextNode(param));
        }
    }
};

/**
 * Shortcut to replace content of a node
 */
hoe.html = function($ele){
    $ele.innerHTML = '';
    for(var i=1, max=arguments.length; i<max; i++){
        var param = arguments[i];
        if(param instanceof Node){
            $ele.appendChild(param);
        }
        else {
            $ele.appendChild(document.createTextNode(param));
        }
    }
};


/**
 * Remove element from DOM
 */
hoe.remove = function($ele){
    if ($ele.parentNode !== null){
        $ele.parentNode.removeChild($ele);
        return true;
    }
    else {
        return false;
    }
{'fraction_non_alphanumeric': 0.13942960615663197, 'fraction_numerical': 0.004526935264825713, 'mean_word_length': 2.3002240477968634, 'pattern_counts': {'":': 0, '<': 11, '<?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': '2910001', 'n_tokens_mistral': 1327, 'n_tokens_neox': 1288, 'n_words': 352}