mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 10:18:15 +09: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:
parent
9123920a19
commit
51dbea3a0e
Notes:
sideshowbarker
2024-07-19 01:59:54 +09:00
Author: https://github.com/awesomekling
Commit: 51dbea3a0e
4 changed files with 11 additions and 11 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue