websetup/ts/websetup.classes.tag.ts

21 lines
582 B
TypeScript
Raw Normal View History

2020-11-04 18:01:04 +00:00
import * as plugins from './websetup.plugins';
export class Tag {
public elementRef: Element;
public tagLevel: 'global' | 'levelbound';
public appendToDom() {
if (!this.elementRef.parentElement && !this.elementRef.parentNode) {
document.getElementsByTagName('head')[0].appendChild(this.elementRef);
}
}
public removeFromDom() {
if (this.elementRef.parentElement) {
this.elementRef.parentElement.removeChild(this.elementRef);
} else if (this.elementRef.parentNode) {
this.elementRef.parentNode.removeChild(this.elementRef);
}
}
}