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

LibWeb: Don't trigger page load for fragment navigation within same URL

This commit is contained in:
Andreas Kling 2022-02-15 13:51:17 +01:00
parent b34dd0fb24
commit 1b2e1c19e1

View file

@ -248,9 +248,8 @@ bool EventHandler::handle_mousedown(const Gfx::IntPoint& position, unsigned butt
if (button == GUI::MouseButton::Primary) {
if (href.starts_with("javascript:")) {
document->run_javascript(href.substring_view(11, href.length() - 11));
} else if (href.starts_with('#')) {
auto anchor = href.substring_view(1, href.length() - 1);
m_browsing_context.scroll_to_anchor(anchor);
} else if (!url.fragment().is_null() && url.equals(document->url(), AK::URL::ExcludeFragment::Yes)) {
m_browsing_context.scroll_to_anchor(url.fragment());
} else {
document->set_active_element(link);
if (m_browsing_context.is_top_level()) {