1// Closes a details/summary dropdown when clicking outside or on a menu item. 2import { Controller } from "@hotwired/stimulus" 3 4export default class extends Controller { 5 connect() { 6 this.clickHandler = this.#onDocumentClick.bind(this) 7 document.addEventListener('click', this.clickHandler) 8 } 9 10 disconnect() { 11 document.removeEventListener('click', this.clickHandler) 12 } 13 14 #onDocumentClick(event) { 15 if (!this.element.contains(event.target)) { 16 this.element.removeAttribute('open') 17 } else if (!event.target.closest('summary')) { 18 this.element.removeAttribute('open') 19 } 20 } 21}
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.