1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:37:37 +00:00

LibWeb: Take a StringView in Document::get_elements_by_class_name

We only ever use the view of the DeprecatedFlyString anyway, so let's
just use a StringView.
This commit is contained in:
Shannon Booth 2023-09-12 22:34:25 +12:00 committed by Andreas Kling
parent ec39a5a41a
commit 827170f6e6
2 changed files with 3 additions and 3 deletions

View file

@ -1189,10 +1189,10 @@ JS::NonnullGCPtr<HTMLCollection> Document::get_elements_by_name(DeprecatedString
});
}
JS::NonnullGCPtr<HTMLCollection> Document::get_elements_by_class_name(DeprecatedFlyString const& class_names)
JS::NonnullGCPtr<HTMLCollection> Document::get_elements_by_class_name(StringView class_names)
{
Vector<FlyString> list_of_class_names;
for (auto& name : class_names.view().split_view(' ')) {
for (auto& name : class_names.split_view(' ')) {
list_of_class_names.append(FlyString::from_utf8(name).release_value_but_fixme_should_propagate_errors());
}
return HTMLCollection::create(*this, HTMLCollection::Scope::Descendants, [list_of_class_names = move(list_of_class_names), quirks_mode = document().in_quirks_mode()](Element const& element) {