diff options
author | Andreas Kling <kling@serenityos.org> | 2020-10-07 12:47:17 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-10-07 12:47:17 +0200 |
commit | 51dbea3a0ee2e46b62a0fc4c62e31b08f57a0d22 (patch) | |
tree | b53dde493bcd7e9ed472302b814b94c79cab6c2e /Libraries/LibWeb/DOM/Document.cpp | |
parent | 9123920a19db313d0ecf6f875f2456f79c4e946f (diff) | |
download | serenity-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.cpp | 6 |
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; |