Object.defineProperty(exports, "__esModule", { value: true });
let normalizeHtml, normalizeHtmlAttribute;
exports.normalizeHtml = normalizeHtml;
exports.normalizeHtmlAttribute = normalizeHtmlAttribute;
if (typeof document !== "undefined") {
    var div = document.createElement("div");
    exports.normalizeHtml = normalizeHtml = function normalizeHtml(str, tagName) {
        if (tagName !== "SCRIPT" && tagName !== "NOSCRIPT") {
            // convert stuff like & to &amp;
            div.innerHTML = str;
            str = div.innerHTML;
        }
        if (tagName === "NOSCRIPT") {
            str = str.replace(/\&/g, "&amp;");
            str = str.replace(/</g, "&lt;");
            str = str.replace(/>/g, "&gt;");
        }
        return str;
    };
    var attrDiv = document.createElement("div");
    exports.normalizeHtmlAttribute = normalizeHtmlAttribute = function normalizeHtmlAttribute(str) {
        attrDiv.setAttribute("sth", str);
        var outerHTML = attrDiv.outerHTML;
        var start = "<div sth='";
        var end = "'></div>";
        return outerHTML.slice(start.length, -end.length);
    };
}
//# sourceMappingURL=normalize.js.map