1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:37:46 +00:00

LibWebView: Clear the Inspector DOM/accessibility trees upon reset

This prevents rendering stale trees while navigating to a new page. The
old non-WebView inspector widgets behaved this way.
This commit is contained in:
Timothy Flynn 2023-12-10 09:32:26 -05:00 committed by Andreas Kling
parent 60c7ff9db1
commit 41ffc69c9d
2 changed files with 16 additions and 2 deletions

View file

@ -85,6 +85,19 @@ const scrollToElement = element => {
window.scrollTo(0, position);
};
inspector.reset = () => {
let domTree = document.getElementById("dom-tree");
domTree.innerHTML = "";
let accessibilityTree = document.getElementById("accessibility-tree");
accessibilityTree.innerHTML = "";
selectedDOMNode = null;
pendingEditDOMNode = null;
inspector.clearConsoleOutput();
};
inspector.loadDOMTree = tree => {
let domTree = document.getElementById("dom-tree");
domTree.innerHTML = atob(tree);