class ModalImage extends HTMLElement { #src = null; #alt = null; #imgElem = null; constructor () { super(); this.attachShadow({ mode: "open" }); this.shadowRoot.innerHTML = ` `; this.#imgElem = this.shadowRoot.querySelector("img"); this.#imgElem.onclick = this.modalZoom.bind(this); } connectedCallback () { const thumbnail = this.getAttribute("thumb") const src = this.getAttribute("src"); const alt = this.getAttribute("alt"); this.#src = src; this.#alt = alt; this.#imgElem.src = thumbnail; this.#imgElem.alt = alt; } modalZoom () { const modalBox = document.createElement("dialog"); modalBox.innerHTML = `