websetup/ts/websetup.classes.tag.ts

22 lines
583 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);
}
}
2020-11-04 18:09:07 +00:00
}