1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:48:12 +00:00

LibWeb: Use RefPtrs more in getElementById() and getElementsByName()

Passing around Vector<Element*> is not a great idea long-term.
This commit is contained in:
Andreas Kling 2020-10-07 12:47:17 +02:00
parent 9123920a19
commit 51dbea3a0e
4 changed files with 11 additions and 11 deletions

View file

@ -141,11 +141,11 @@ void Frame::scroll_to_anchor(const String& fragment)
if (!document())
return;
const auto* element = document()->get_element_by_id(fragment);
auto element = document()->get_element_by_id(fragment);
if (!element) {
auto candidates = document()->get_elements_by_name(fragment);
for (auto* candidate : candidates) {
if (is<HTML::HTMLAnchorElement>(*candidate)) {
for (auto& candidate : candidates) {
if (is<HTML::HTMLAnchorElement>(candidate)) {
element = downcast<HTML::HTMLAnchorElement>(candidate);
break;
}