MCPcopy
hub / github.com/QwikDev/qwik / processDocumentEvent

Function processDocumentEvent

packages/qwik/src/qwikloader.ts:198–215  ·  view source on GitHub ↗
(ev: Event)

Source from the content-addressed store, hash-verified

196 * @param ev - Browser event.
197 */
198const processDocumentEvent = async (ev: Event) => {
199 // eslint-disable-next-line prefer-const
200 let type = camelToKebab(ev.type);
201 let element = ev.target as Element | null;
202 broadcast('-document', ev, type);
203
204 while (element && element.getAttribute) {
205 const results = dispatch(element, '', ev, type);
206 let cancelBubble = ev.cancelBubble;
207 if (isPromise(results)) {
208 await results;
209 }
210 // if another async handler stopPropagation
211 cancelBubble ||=
212 cancelBubble || ev.cancelBubble || element.hasAttribute('stoppropagation:' + ev.type);
213 element = ev.bubbles && cancelBubble !== true ? element.parentElement : null;
214 }
215};
216
217const processWindowEvent = (ev: Event) => {
218 broadcast('-window', ev, camelToKebab(ev.type));

Callers

nothing calls this directly

Calls 5

camelToKebabFunction · 0.85
broadcastFunction · 0.85
dispatchFunction · 0.70
isPromiseFunction · 0.70
hasAttributeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…