pragma-views2
Version:
17 lines (15 loc) • 512 B
JavaScript
class UseCss extends HTMLElement {
connectedCallback() {
this.link = document.createElement("link");
this.link.rel = "stylesheet";
this.link.type = "text/css";
this.link.media = "screen";
this.link.href = `/app/styles/${this.getAttribute("src")}`;
document.head.appendChild(this.link);
}
disconnectedCallback() {
document.head.removeChild(this.link);
this.link = null;
}
}
customElements.define("use-css", UseCss);