summaryrefslogtreecommitdiff
path: root/Libraries/LibWeb/DOM/Document.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-10-07 12:47:17 +0200
committerAndreas Kling <kling@serenityos.org>2020-10-07 12:47:17 +0200
commit51dbea3a0ee2e46b62a0fc4c62e31b08f57a0d22 (patch)
treeb53dde493bcd7e9ed472302b814b94c79cab6c2e /Libraries/LibWeb/DOM/Document.cpp
parent9123920a19db313d0ecf6f875f2456f79c4e946f (diff)
downloadserenity-51dbea3a0ee2e46b62a0fc4c62e31b08f57a0d22.zip
LibWeb: Use RefPtrs more in getElementById() and getElementsByName()
Passing around Vector<Element*> is not a great idea long-term.
Diffstat (limited to 'Libraries/LibWeb/DOM/Document.cpp')
-rw-r--r--Libraries/LibWeb/DOM/Document.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/Libraries/LibWeb/DOM/Document.cpp b/Libraries/LibWeb/DOM/Document.cpp
index 97aa172646..efb64b68e5 100644
--- a/Libraries/LibWeb/DOM/Document.cpp
+++ b/Libraries/LibWeb/DOM/Document.cpp
@@ -359,12 +359,12 @@ void Document::set_hovered_node(Node* node)
invalidate_style();
}
-Vector<const Element*> Document::get_elements_by_name(const String& name) const
+NonnullRefPtrVector<Element> Document::get_elements_by_name(const String& name) const
{
- Vector<const Element*> elements;
+ NonnullRefPtrVector<Element> elements;
for_each_in_subtree_of_type<Element>([&](auto& element) {
if (element.attribute(HTML::AttributeNames::name) == name)
- elements.append(&element);
+ elements.append(element);
return IterationDecision::Continue;
});
return elements;