Anne van Kesteren wrote:
An EventListener has the advantage of being an existing interface, but
somehow it seems weird to use it if XHR isn't an EventTarget.
I agree. I actually want XHR to be an EventTarget as well because it
makes sense, but the only problem is that there's no implementation for
that...
It's an EventTarget in Gecko.
There's also the issue of what you pass as the Event object to
handleEvent.
I notice that Mozilla recently made a decision wrt this
(https://bugzilla.mozilla.org/show_bug.cgi?id=198595).
Yeah, there should be an open issue on that. I'd like `this` to return
the XMLHttpRequest object. Opera does that. Internet Explorer and Safari
return the Window object. Mozilla returns the Function object you passed
to onreadystatechange...
Note that the behavior of |this| in this function is somewhat independent of
whether we're looking at an EventListener.
Also note that https://bugzilla.mozilla.org/show_bug.cgi?id=198595 in fact
changes the |this| in Gecko to be the XMLHttpRequest object.
-Boris