1const handlers = new Map(); 2 3export function setControlAttribute(id, attrName, value) { 4 const fieldElement = document.querySelector("#" + id)?.shadowRoot?.querySelector(".selected-value"); 5 6 if (!!fieldElement) { 7 fieldElement?.setAttribute(attrName, value); 8 } 9} 10 11export function attachIndicatorClickHandler(id) { 12 const combobox = document.querySelector("#" + id); 13 if (!combobox) return; 14 15 const indicator = combobox.shadowRoot?.querySelector('[part="indicator"]'); 16 17 if (!indicator) return; 18 19 const clickHandler = (event) => { 20 if (combobox.hasAttribute('open')) { 21 event.preventDefault(); 22 event.stopImmediatePropagation(); 23 24 const escEvent = new KeyboardEvent('keydown', { 25 key: 'Escape', 26 code: 'Escape', 27 keyCode: 27, 28 bubbles: true, 29 cancelable: true 30 }); 31 32 combobox.dispatchEvent(escEvent); 33 } 34 }; 35 36 if (indicator) { 37 indicator.addEventListener('click', clickHandler); 38 } 39 40 handlers.set(id, { indicator, clickHandler }); 41} 42 43export function detachIndicatorClickHandler(id) { 44 const handler = handlers.get(id); 45 if (handler) { 46 const { indicator, clickHandler } = handler; 47 48 if (indicator) { 49 indicator.removeEventListener('click', clickHandler); 50 } 51 52 handlers.delete(id); 53 } 54}
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.