* @see https://dom.spec.whatwg.org/#concept-event-fire * @param {string} e * @param {EventTarget} target * @param {(...args: ConstructorParameters ) => Event} eventFactory * @param {EventInit | undefined} eventInitDict * @returns {void}
(e, target, eventFactory = (type, init) => new Event(type, init), eventInitDict = {})
| 54 | * @returns {void} |
| 55 | */ |
| 56 | function fireEvent (e, target, eventFactory = (type, init) => new Event(type, init), eventInitDict = {}) { |
| 57 | // 1. If eventConstructor is not given, then let eventConstructor be Event. |
| 58 | |
| 59 | // 2. Let event be the result of creating an event given eventConstructor, |
| 60 | // in the relevant realm of target. |
| 61 | // 3. Initialize event’s type attribute to e. |
| 62 | const event = eventFactory(e, eventInitDict) |
| 63 | |
| 64 | // 4. Initialize any other IDL attributes of event as described in the |
| 65 | // invocation of this algorithm. |
| 66 | |
| 67 | // 5. Return the result of dispatching event at target, with legacy target |
| 68 | // override flag set if set. |
| 69 | target.dispatchEvent(event) |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * @see https://websockets.spec.whatwg.org/#feedback-from-the-protocol |
no test coverage detected