mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 12:05:15 +00:00
LibHTML: <a href="#foo"> should prefer any element type with id=foo
It turns out that other engines also prefer <h1 id=x> over <a name=x>. So we can just use get_element_by_id() directly without worrying about the type of element we find.
This commit is contained in:
parent
8e710b16de
commit
04b94a7695
Notes:
sideshowbarker
2024-07-19 11:36:00 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/04b94a76952
1 changed files with 1 additions and 5 deletions
|
@ -319,11 +319,7 @@ void HtmlView::scroll_to_anchor(const StringView& name)
|
|||
if (!document())
|
||||
return;
|
||||
|
||||
const HTMLAnchorElement* element = nullptr;
|
||||
if (auto* candidate = document()->get_element_by_id(name)) {
|
||||
if (is<HTMLAnchorElement>(*candidate))
|
||||
element = to<HTMLAnchorElement>(candidate);
|
||||
}
|
||||
auto* element = document()->get_element_by_id(name);
|
||||
if (!element) {
|
||||
auto candidates = document()->get_elements_by_name(name);
|
||||
for (auto* candidate : candidates) {
|
||||
|
|
Loading…
Add table
Reference in a new issue