Skip to content

Commit

Permalink
Build HTML element explicitly instead of creating element
Browse files Browse the repository at this point in the history
  • Loading branch information
Guilherme Beltramini committed May 28, 2020
1 parent 4d78a94 commit 0208c48
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions packages/rendermime/src/renderers.ts
Expand Up @@ -486,14 +486,10 @@ function autolink(content: string): string {
'"\')}\\],:;.!?>]',
'ug'
);
return content.replace(webLinkRegex, url => {
const a = document.createElement('a');
a.href = url;
a.textContent = url;
a.rel = 'noopener';
a.target = '_blank';
return a.outerHTML;
});
return content.replace(
webLinkRegex,
'<a href="$&" rel="noopener" target="_blank">$&</a>'
);
}

/**
Expand Down

0 comments on commit 0208c48

Please sign in to comment.