move mutob proxy into the document catcher

This commit is contained in:
velzie 2024-07-19 18:04:44 -04:00
parent 084f2cd789
commit ec5ef8e03f
No known key found for this signature in database
GPG key ID: 048413F95F0DDE1F

View file

@ -128,18 +128,7 @@ Object.defineProperty(Element.prototype, "innerHTML", {
}, },
}); });
MutationObserver.prototype.observe = new Proxy( for (const target of [Node.prototype, MutationObserver.prototype, document]) {
MutationObserver.prototype.observe,
{
apply(target, thisArg, argArray) {
if (argArray[0] === documentProxy) argArray[0] = document;
return Reflect.apply(target, thisArg, argArray);
},
}
);
for (const target of [Node.prototype, document]) {
for (const prop in target) { for (const prop in target) {
try { try {
if (typeof target[prop] === "function") { if (typeof target[prop] === "function") {
@ -154,4 +143,3 @@ for (const target of [Node.prototype, document]) {
} catch (e) { } } catch (e) { }
} }
} }