/** * URL helpers for matching a title/favicon to the visit it belongs to. * * The document (and therefore its title) is identified by everything up to the * fragment: "/page" and "/page#section" are the same document. tab.url often * gains a #fragment after load (scroll anchors, in-page nav) while the visit's * committed url has none, so we must compare with the fragment stripped or the * title silently fails to attach. */ export function stripHash(url: string): string { const i = url.indexOf("#"); return i === -1 ? url : url.slice(0, i); } export function sameDocument(a: string, b: string): boolean { return stripHash(a) === stripHash(b); }