Describe the bug
When executed in Partytown web worker, DOM node traversal using TreeWalker never advances and falls into infinite loops.
To Reproduce
Steps to reproduce the behavior:
In a script block of type text/partytown, get a TreeWalker instance by calling document.createTreeWalker()
Traverse DOM nodes using the TreeWalker instance by:
const treeWalker = document.createTreeWalker(document.body, 1);
do {
// some code like:
console.log(treeWalker.currentNode.nodeName);
} while (treeWalker.nextNode());
Observation: the loop above never ends and treeWalker.currentNode is always the initial DOM node.
Reproduction link
A test case has been created in this PR. To run the test case:
npx playwright test tests/platform/tree-walker --browser=chromium
Expected behavior
The DOM tree traversal should advance and complete normally as being executed on main thread.
Describe the bug When executed in Partytown web worker, DOM node traversal using TreeWalker never advances and falls into infinite loops.
To Reproduce Steps to reproduce the behavior:
text/partytown
, get a TreeWalker instance by callingdocument.createTreeWalker()
treeWalker.currentNode
is always the initial DOM node.Reproduction link A test case has been created in this PR. To run the test case:
Expected behavior The DOM tree traversal should advance and complete normally as being executed on main thread.
Partytown version 0.6.4
Screenshots N/A.
Additional context None.