fix(portal): classify sanitized report anchors by visible label
This commit is contained in:
1 parent
16a72caa00
commit
db8d90f579
1 file changed
+1
-1
@@ -22,7 +22,7 @@ export function safePortalContent(html: string): DocumentFragment {
|
|||||||
element.setAttribute('rel', 'noopener noreferrer');
|
element.setAttribute('rel', 'noopener noreferrer');
|
||||||
element.setAttribute('referrerpolicy', 'no-referrer');
|
element.setAttribute('referrerpolicy', 'no-referrer');
|
||||||
if (url.origin !== location.origin && url.protocol === 'https:') element.setAttribute('target', '_blank');
|
if (url.origin !== location.origin && url.protocol === 'https:') element.setAttribute('target', '_blank');
|
||||||
const presentation = portalLinkPresentation([...source.classList], source.style.backgroundColor, url.protocol);
|
const presentation = portalLinkPresentation([...source.classList], source.style.backgroundColor, url.protocol, source.textContent ?? '');
|
||||||
if (presentation) element.className = presentation;
|
if (presentation) element.className = presentation;
|
||||||
}
|
}
|
||||||
} catch { /* Invalid destination remains visible text without navigation. */ }
|
} catch { /* Invalid destination remains visible text without navigation. */ }
|
||||||
|
|||||||
Reference in new issue
Block a user