Jacky Zhao
2025-03-09 9c8fec06d2b58e4e3bbe280ddc665a99fcc4878c
quartz/components/scripts/spa.inline.ts
@@ -75,6 +75,10 @@
  if (!contents) return
  // notify about to nav
  const event: CustomEventMap["prenav"] = new CustomEvent("prenav", { detail: {} })
  document.dispatchEvent(event)
  // cleanup old
  cleanupFns.forEach((fn) => fn())
  cleanupFns.clear()
@@ -108,7 +112,7 @@
    }
  }
  // now, patch head
  // now, patch head, re-executing scripts
  const elementsToRemove = document.head.querySelectorAll(":not([spa-preserve])")
  elementsToRemove.forEach((el) => el.remove())
  const elementsToAdd = html.head.querySelectorAll(":not([spa-preserve])")