fix event proxy throwing when handler is null

This commit is contained in:
velzie 2024-07-30 07:20:49 -04:00
parent d7c6044602
commit 881492ffff
No known key found for this signature in database
GPG key ID: 048413F95F0DDE1F

View file

@ -45,10 +45,13 @@ export default function (client: ScramjetClient, self: Self) {
client.Proxy("EventTarget.prototype.addEventListener", {
apply(ctx) {
if (typeof ctx.args[1] === "object")
ctx.args[1] = wraplistener(ctx.args[1]);
},
});
// TODO: removeEventListener
if (!iswindow) return;
const targets = [self.window, self.HTMLElement.prototype];