package.src.sanitize.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mikado Show documentation
Show all versions of mikado Show documentation
Web's fastest template library to build user interfaces.
The newest version!
// COMPILER BLOCK -->
import { RELEASE } from "./config.js";
// <-- COMPILER BLOCK
const escape_div = document.createElement("div");
const escape_text = document.createTextNode("");
const sanitizer_div = document.createElement("div");
RELEASE !== "light" && RELEASE !== "light.module" && escape_div.appendChild(escape_text);
/**
* @param {*} str
* @return {string}
*/
export function escape(str){
if(escape_div._text !== str){
escape_text.nodeValue = /** @type {string} */ (str);
escape_div._html = escape_div.innerHTML;
escape_div._text = str;
}
return escape_div._html;
}
/**
* @param {*} str
* @return {string}
*/
export function sanitize(str){
if(sanitizer_div._html !== str){
sanitizer_div.innerHTML = str;
sanitizer_div._html = str;
sanitizer_div._text = sanitizer_div.textContent;
}
return sanitizer_div._text;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy