mirror of
https://github.com/wukko/cobalt.git
synced 2025-06-13 05:37:44 +02:00
web/OuterLink: don't set target/rel for relative links
This commit is contained in:
@ -5,8 +5,17 @@
|
||||
// no way to change this behavior atm (https://github.com/pngwn/MDsveX/issues/609)
|
||||
export let rel: string = "";
|
||||
rel;
|
||||
|
||||
const [ target, _rel ] = (() => {
|
||||
try {
|
||||
new URL(href)
|
||||
return [ '_blank', 'noopener noreferrer' ];
|
||||
} catch {}
|
||||
|
||||
return [];
|
||||
})();
|
||||
</script>
|
||||
|
||||
<a target="_blank" rel="noopener noreferrer" {href}>
|
||||
<a rel={_rel} {target} {href}>
|
||||
<slot></slot>
|
||||
</a>
|
||||
|
Reference in New Issue
Block a user