Describe the bug
XMLHttpRequest dispatches loadstart, load, loadend and abort as plain Event instances. Per the specification, the send() algorithm fires all of these as ProgressEvent, so listeners can read event.loaded, event.total and event.lengthComputable. On happy-dom, those properties are undefined because the events are not ProgressEvent instances at all.
To Reproduce
Steps to reproduce the behavior:
- Create an
XMLHttpRequest, open and send a request that returns a response with a Content-Length header.
- Add a
load (or loadstart/loadend/abort) listener.
- Inspect the event received by the listener.
const xhr = new XMLHttpRequest();
xhr.addEventListener('load', (event) => {
console.log(event instanceof ProgressEvent); // false, but should be true
console.log(event.loaded, event.total); // undefined, undefined
});
xhr.open('GET', '/some-resource');
xhr.send();
https://stackblitz.com/edit/happy-dom-load-progress-events?file=index.js
Expected behavior
loadstart, load, loadend and abort should be dispatched as ProgressEvent instances, with loaded/total/lengthComputable populated the same way they are for the already-supported progress event (0/0/false for loadstart/abort, and the transferred/total byte counts for load/loadend).
Device and details:
- OS: MacOS 26.6.1
- Node version: 24.19.0
- Package version: 20.11.2
Additional context
Relevant spec section: https://xhr.spec.whatwg.org/#the-send()-method ("fire a progress event named ...").
Describe the bug
XMLHttpRequestdispatchesloadstart,load,loadendandabortas plainEventinstances. Per the specification, the send() algorithm fires all of these asProgressEvent, so listeners can readevent.loaded,event.totalandevent.lengthComputable. On happy-dom, those properties areundefinedbecause the events are notProgressEventinstances at all.To Reproduce
Steps to reproduce the behavior:
XMLHttpRequest, open and send a request that returns a response with aContent-Lengthheader.load(orloadstart/loadend/abort) listener.https://stackblitz.com/edit/happy-dom-load-progress-events?file=index.js
Expected behavior
loadstart,load,loadendandabortshould be dispatched asProgressEventinstances, withloaded/total/lengthComputablepopulated the same way they are for the already-supportedprogressevent (0/0/false forloadstart/abort, and the transferred/total byte counts forload/loadend).Device and details:
Additional context
Relevant spec section: https://xhr.spec.whatwg.org/#the-send()-method ("fire a progress event named ...").