proxy treewalker currentNode to not use fake document

This commit is contained in:
velzie 2024-07-28 10:45:42 -04:00
parent b0f5166916
commit 8d2f23badb
No known key found for this signature in database
GPG key ID: 048413F95F0DDE1F

View file

@ -155,6 +155,19 @@ export default function (client: ScramjetClient, self: typeof window) {
},
});
client.Trap("TreeWalker.prototype.currentNode", {
get(ctx) {
return ctx.get();
},
set(ctx, value) {
if (value == client.documentProxy) {
return ctx.set(self.document);
}
return ctx.set(value);
},
});
for (const target of [
self.Node.prototype,
self.MutationObserver.prototype,