Browse Source

Add to anchor rel attributes do not overwrite

pull/2272/head
Gabe Kangas 3 years ago
parent
commit
64a2fbd3e8
No known key found for this signature in database
GPG Key ID: 9A56337728BC81EA
  1. 4
      web/utils/no-link-referrer.ts

4
web/utils/no-link-referrer.ts

@ -15,7 +15,9 @@ export default function setupNoLinkReferrer(observationRoot: HTMLElement): void
const config = { attributes: false, childList: true, subtree: true }; const config = { attributes: false, childList: true, subtree: true };
const addNoReferrer = (node: Element): void => { const addNoReferrer = (node: Element): void => {
node.setAttribute('rel', 'noopener noreferrer '); const existingAttributes = node.getAttribute('rel');
const attributes = `${existingAttributes} noopener noreferrer`;
node.setAttribute('rel', attributes);
}; };
// Callback function to execute when mutations are observed // Callback function to execute when mutations are observed

Loading…
Cancel
Save