websetup/ts/websetup.classes.tag.linktag.ts
2020-11-04 18:01:04 +00:00

14 lines
447 B
TypeScript

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;
}
}