From 8d2f23badb7e140b27c9d846057e3ae16e21590e Mon Sep 17 00:00:00 2001 From: velzie Date: Sun, 28 Jul 2024 10:45:42 -0400 Subject: [PATCH] proxy treewalker currentNode to not use fake document --- src/client/dom/element.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/client/dom/element.ts b/src/client/dom/element.ts index 513e5cb..fbe16c1 100644 --- a/src/client/dom/element.ts +++ b/src/client/dom/element.ts @@ -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,