/** ! * Sanitize an HTML string * (c) 2021 Chris Ferdinandi, MIT License, https://gomakethings.com * @param {String} str The HTML string to sanitize * @param {Boolean} nodes If true, returns HTML nodes instead of a string * @return {String|NodeList} The sanitized string or nodes */ function cleanHTML(str, nodes) { /** * Convert the string to an HTML document * @return {Node} An HTML document */ function stringToHTML() { const parser = new DOMParser(); const doc = parser.parseFromString(str, 'text/html'); return doc.body || document.createElement('body'); } /** * Remove