mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:17:36 +00:00
Browser: Reset the DOM Inspector's state when re-opening it
This resets the DOM Inspector to a default state when re-opening it, instead of it displaying the previous selection and properties, which may be outdated. This is closer to how Chrome and Firefox behave. Eventually, it probably makes sense to copy their behavior of selecting the `<body>` element by default.
This commit is contained in:
parent
97379ace25
commit
73c95bcd5f
3 changed files with 28 additions and 4 deletions
|
@ -485,6 +485,9 @@ void Tab::show_inspector_window(Browser::Tab::InspectorTarget inspector_target)
|
|||
Optional<i32> hovered_node = m_web_content_view->get_hovered_node_id();
|
||||
VERIFY(hovered_node.has_value());
|
||||
m_dom_inspector_widget->set_inspected_node(hovered_node.value());
|
||||
} else {
|
||||
VERIFY(inspector_target == InspectorTarget::Document);
|
||||
m_dom_inspector_widget->select_default_node();
|
||||
}
|
||||
|
||||
auto* window = m_dom_inspector_widget->window();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue