mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 16:18:12 +00:00
LibWeb: Add Document.getElementsByTagName()
This commit is contained in:
parent
200481efb2
commit
edf0aacda4
3 changed files with 13 additions and 0 deletions
|
@ -333,6 +333,17 @@ Vector<const Element*> Document::get_elements_by_name(const String& name) const
|
|||
return elements;
|
||||
}
|
||||
|
||||
NonnullRefPtrVector<Element> Document::get_elements_by_tag_name(const String& tag_name) const
|
||||
{
|
||||
NonnullRefPtrVector<Element> elements;
|
||||
for_each_in_subtree_of_type<Element>([&](auto& element) {
|
||||
if (element.tag_name() == tag_name)
|
||||
elements.append(element);
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
return elements;
|
||||
}
|
||||
|
||||
RefPtr<Element> Document::query_selector(const StringView& selector_text)
|
||||
{
|
||||
auto selector = parse_selector(selector_text);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue