1class DetailsModal extends HTMLElement { 2 constructor() { 3 super(), this.detailsContainer = this.querySelector("details"), this.summaryToggle = this.querySelector("summary"), this.detailsContainer.addEventListener("keyup", t => "ESCAPE" === t.code.toUpperCase() && this.close()), this.summaryToggle.addEventListener("click", this.onSummaryClick.bind(this)), this.querySelector('button[type="button"]').addEventListener("click", this.close.bind(this)), this.summaryToggle.setAttribute("role", "button") 4 } 5 6 isOpen() { 7 return this.detailsContainer.hasAttribute("open") 8 } 9 10 onSummaryClick(t) { 11 t.preventDefault(), t.target.closest("details").hasAttribute("open") ? this.close() : this.open(t) 12 } 13 14 onBodyClick(t) { 15 this.contains(t.target) && !t.target.classList.contains("modal-overlay") || this.close(!1) 16 } 17 18 open(t) { 19 this.onBodyClickEvent = this.onBodyClickEvent || this.onBodyClick.bind(this), t.target.closest("details").setAttribute("open", !0), document.body.addEventListener("click", this.onBodyClickEvent), document.body.classList.add("overflow-hidden"), trapFocus(this.detailsContainer.querySelector('[tabindex="-1"]'), this.detailsContainer.querySelector('input:not([type="hidden"])')) 20 } 21 22 close(t = !0) { 23 removeTrapFocus(t ? this.summaryToggle : null), this.detailsContainer.removeAttribute("open"), document.body.removeEventListener("click", this.onBodyClickEvent), document.body.classList.remove("overflow-hidden") 24 } 25} 26 27customElements.define("details-modal", DetailsModal);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.