MCPcopy Create free account
hub / github.com/compiler-explorer/compiler-explorer / setElementEventHandler

Function setElementEventHandler

static/bootstrap-utils.ts:112–128  ·  view source on GitHub ↗
(
    element: JQuery<HTMLElement> | HTMLElement,
    eventName: string,
    handler: (event: Event) => void,
)

Source from the content-addressed store, hash-verified

110 * @param handler The event handler function
111 */
112export function setElementEventHandler(
113 element: JQuery<HTMLElement> | HTMLElement,
114 eventName: string,
115 handler: (event: Event) => void,
116): void {
117 // If jQuery object with potentially multiple elements
118 if (!(element instanceof HTMLElement)) {
119 // Loop through all elements in the jQuery collection
120 element.each((_index, domElement) => {
121 setDomElementEventHandler(domElement, eventName, handler);
122 });
123 return;
124 }
125
126 // Otherwise it's a single DOM element
127 setDomElementEventHandler(element, eventName, handler);
128}
129
130/**
131 * Get an existing modal instance for an element

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected