Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix: url fragment is not processed correctly
Issue appears in these cases:
1. fragment contains spesial characters (quotes for example)
2. fragment starts with number
  • Loading branch information
tordex committed Jun 3, 2025
commit bd0f56f6baa170ff5b66acbba2110d186b868960
8 changes: 2 additions & 6 deletions support/webpage/web_page.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,9 @@ void litebrowser::web_page::show_hash(const litehtml::string& hash)
m_html_host->scroll_to(0, 0);
} else
{
std::string selector = "#" + hash;
auto escaped_hash = litehtml::get_escaped_string(hash);
std::string selector = ":is([id=\"" + escaped_hash + "\"],[name=\"" + escaped_hash + "\"])";
litehtml::element::ptr el = m_html->root()->select_one(selector);
if (!el)
{
selector = "[name=" + hash + "]";
el = m_html->root()->select_one(selector);
}
if (el)
{
litehtml::position pos = el->get_placement();
Expand Down