From 51dbea3a0ee2e46b62a0fc4c62e31b08f57a0d22 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 7 Oct 2020 12:47:17 +0200 Subject: LibWeb: Use RefPtrs more in getElementById() and getElementsByName() Passing around Vector is not a great idea long-term. --- Libraries/LibWeb/DOM/Document.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Libraries/LibWeb/DOM/Document.cpp') 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 Document::get_elements_by_name(const String& name) const +NonnullRefPtrVector Document::get_elements_by_name(const String& name) const { - Vector elements; + NonnullRefPtrVector elements; for_each_in_subtree_of_type([&](auto& element) { if (element.attribute(HTML::AttributeNames::name) == name) - elements.append(&element); + elements.append(element); return IterationDecision::Continue; }); return elements; -- cgit v1.2.3