/** * Sanitize an HTML string * (c) 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 () { let parser = new DOMParser(); let doc = parser.parseFromString(str, 'text/html'); return doc.body || document.createElement('body'); } /** * Remove