const createNode = (content = '', tag = 'div') => {
    const node = document.createElement(tag);
    node.innerHTML = content;
    return node;
};
const setChildAttributes = (parentEl, attribute, value) => {
    Array.from(parentEl.children).forEach((el) => el.setAttribute(attribute, value));
};
// IE11-safe SVG innerHTML
const getSvgInnerHTML = (el) => {
    if (el.innerHTML !== undefined)
        return el.innerHTML;
    const XMLS = new XMLSerializer();
    const nodes = [];
    const nodesCount = el.childNodes.length;
    let i = 0;
    for (i; i < nodesCount; i++) {
        nodes.push(XMLS.serializeToString(el.childNodes[i]));
    }
    return nodes.join('');
};
const escapeHTML = (str) => str.replace(/[\u00A0-\u9999<>\&]/gim, function (i) {
    return '&#' + i.charCodeAt(0) + ';';
});
export { createNode, setChildAttributes, getSvgInnerHTML, escapeHTML };
