fix(spa): Normalize empty hrefs (#1695)
A final breadcrumb has an empty href, linking to the current page, but
the relative url normalization method missed those, making the link
appear broken in search previews and popovers.
Fixes #1690
| | |
| | | el.setAttribute(attr, rebased.pathname + rebased.hash) |
| | | } |
| | | export function normalizeRelativeURLs(el: Element | Document, destination: string | URL) { |
| | | el.querySelectorAll('[href^="./"], [href^="../"]').forEach((item) => |
| | | el.querySelectorAll('[href=""], [href^="./"], [href^="../"]').forEach((item) => |
| | | _rebaseHtmlElement(item, "href", destination), |
| | | ) |
| | | el.querySelectorAll('[src^="./"], [src^="../"]').forEach((item) => |
| | | el.querySelectorAll('[src=""], [src^="./"], [src^="../"]').forEach((item) => |
| | | _rebaseHtmlElement(item, "src", destination), |
| | | ) |
| | | } |