setInnerHtml = (elem, html) => {
  elem.textContent = ''
  if (html) {
    const parser = new DOMParser()
    const parsed = parser.parseFromString(html, `text/html`)
    const head = parsed.querySelector('head')
    if (head) {
      Array.from(head.childNodes).forEach((child) => {
        elem.appendChild(child)
      })
    }
    const body = parsed.querySelector('body')
    if (body) {
      Array.from(body.childNodes).forEach((child) => {
        if (child instanceof HTMLVideoElement || child instanceof HTMLAudioElement) {
          elem.appendChild(child.cloneNode(true)) // https://github.com/sweetalert2/sweetalert2/issues/2507
        } else {
          elem.appendChild(child)
        }
      })
    }
  }
}
Securely set innerHTML of an element
https://github.com/sweetalert2/sweetalert2/issues/1926

@param {HTMLElement} elem
@param {string} html