fix addEventListener

This commit is contained in:
velzie 2024-07-18 20:26:39 -04:00
parent 6a5ecc4efc
commit fd4bb03340
No known key found for this signature in database
GPG key ID: 048413F95F0DDE1F
3 changed files with 29 additions and 5 deletions

View file

@ -77,3 +77,27 @@ export const documentProxy = new Proxy(document, {
return Reflect.set(target, prop, newValue);
},
});
Function.prototype.apply = new Proxy(Function.prototype.apply, {
apply(target, thisArg, argArray) {
if (argArray[0] === windowProxy) {
argArray[0] = window;
} else if (argArray[0] === documentProxy) {
argArray[0] = document;
}
return Reflect.apply(target, thisArg, argArray);
},
});
Function.prototype.call = new Proxy(Function.prototype.call, {
apply(target, thisArg, argArray) {
if (argArray[0] === windowProxy) {
argArray[0] = window;
} else if (argArray[0] === documentProxy) {
argArray[0] = document;
}
return Reflect.apply(target, thisArg, argArray);
},
});