mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-26 10:49:38 +02:00
fix: clean link unit test resolved
This commit is contained in:
@@ -30,7 +30,7 @@ export const removeScript = (txt: string): string => {
|
|||||||
|
|
||||||
DOMPurify.addHook('afterSanitizeAttributes', function (node) {
|
DOMPurify.addHook('afterSanitizeAttributes', function (node) {
|
||||||
// set all elements owning target to target=_blank
|
// set all elements owning target to target=_blank
|
||||||
if ('target' in node) {
|
if (node.tagName === 'A' && node.hasAttribute('href') && 'target' in node) {
|
||||||
node.setAttribute('target', '_blank');
|
node.setAttribute('target', '_blank');
|
||||||
node.setAttribute('rel', 'noopener noreferrer');
|
node.setAttribute('rel', 'noopener noreferrer');
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user