function normalizeScriptTags(fragment) {
    Array.from(fragment.querySelectorAll('script')).forEach(/** @param {HTMLScriptElement} script */ (script) => {
      if (isJavaScriptScriptNode(script)) {
        const newScript = duplicateScript(script)
        const parent = script.parentNode
        try {
          parent.insertBefore(newScript, script)
        } catch (e) {
          logError(e)
        } finally {
          script.remove()
        }
      }
    })
  }
we have to make new copies of script tags that we are going to insert because
SOME browsers (not saying who, but it involves an element and an animal) don't
execute scripts created in <template> tags when they are inserted into the DOM
and all the others do lmao
@param {DocumentFragment} fragment