mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-22 10:59:51 +03:00
LibWeb: Make Element::get_elements_by_class_name take a StringView
We only make use of the view of the view in this function.
This commit is contained in:
parent
79f97da4b4
commit
3458a53cb4
Notes:
sideshowbarker
2024-07-16 20:31:50 +09:00
Author: https://github.com/shannonbooth Commit: https://github.com/SerenityOS/serenity/commit/3458a53cb4 Pull-request: https://github.com/SerenityOS/serenity/pull/21174 Reviewed-by: https://github.com/awesomekling
@ -748,10 +748,10 @@ bool Element::is_document_element() const
|
||||
return document().document_element() == this;
|
||||
}
|
||||
|
||||
JS::NonnullGCPtr<HTMLCollection> Element::get_elements_by_class_name(DeprecatedFlyString const& class_names)
|
||||
JS::NonnullGCPtr<HTMLCollection> Element::get_elements_by_class_name(StringView class_names)
|
||||
{
|
||||
Vector<FlyString> list_of_class_names;
|
||||
for (auto& name : class_names.view().split_view_if(Infra::is_ascii_whitespace)) {
|
||||
for (auto& name : class_names.split_view_if(Infra::is_ascii_whitespace)) {
|
||||
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) {
|
||||
|
@ -199,7 +199,7 @@ public:
|
||||
bool is_target() const;
|
||||
bool is_document_element() const;
|
||||
|
||||
JS::NonnullGCPtr<HTMLCollection> get_elements_by_class_name(DeprecatedFlyString const&);
|
||||
JS::NonnullGCPtr<HTMLCollection> get_elements_by_class_name(StringView);
|
||||
|
||||
bool is_shadow_host() const;
|
||||
ShadowRoot* shadow_root_internal() { return m_shadow_root.ptr(); }
|
||||
|
Loading…
Reference in New Issue
Block a user