Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The monkey-patch for maintaining the open element stack, as modified by commit 75a921e, maintained a reference to the most recent JSDOMParse5Adapter through the push/pop closures. This means there was always a reference from the rooted OpenElementStack.prototype.{push,pop} functions to the most recent JSDOMParse5Adapter and its related objects. Since one of the related objects was an element, which has a pointer to a document and window, essentially the whole JSDOM would be retained. This commit instead uses the this.treeAdapter pointer, which already exists in parse5. Doing so also allows us to move the monkeypatch back into the top level, instead of establishing it on construction of each tree adapter. Closes #2831. Closes #2825. Helps with the root cause of jestjs/jest#9507.
- Loading branch information