websetup/ts/websetup.classes.tag.linktag.ts

14 lines
447 B
TypeScript
Raw Normal View History

2020-11-04 18:01:04 +00:00
import { Tag } from './websetup.classes.tag';
export class LinkTag extends Tag {
constructor(relArg: string, hrefArg: string) {
super();
const linkElement = !!document.querySelector("link[rel='canonical']")
? document.querySelector("link[rel='canonical']")
: document.createElement('link');
linkElement.setAttribute('rel', relArg);
linkElement.setAttribute('href', hrefArg);
this.elementRef = linkElement;
}
}