JSFiddle - React, Tailwind, and code Playground
by Sova
HTML
<script src="https://rawgit.com/leizongmin/js-xss/master/dist/xss.js"></script>
<div id="container">
</div>
<div id="container2">
</div>
JavaScript
const container = document.getElementById('container');
const container2 = document.getElementById('container2');
const html = `<div>
<b>Some text</b>
<strong>Another text</strong>
</div>`;
const commonHtml = filterXSS(html, {
whiteList: {},
});
const whitedHtml = filterXSS(html, {
whiteList: {},
onTag(tag, html, options) {
options.isWhite = true;
}
});
container.innerHTML = commonHtml;
container2.innerHTML = whitedHtml;