From 3458a53cb49a22890c8970c329fb89ff993e3392 Mon Sep 17 00:00:00 2001 From: Shannon Booth Date: Thu, 21 Sep 2023 20:32:09 +1200 Subject: [PATCH] LibWeb: Make Element::get_elements_by_class_name take a StringView We only make use of the view of the view in this function. --- Userland/Libraries/LibWeb/DOM/Element.cpp | 4 ++-- Userland/Libraries/LibWeb/DOM/Element.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp index aa23b36bb3..1a4cd39e07 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.cpp +++ b/Userland/Libraries/LibWeb/DOM/Element.cpp @@ -748,10 +748,10 @@ bool Element::is_document_element() const return document().document_element() == this; } -JS::NonnullGCPtr Element::get_elements_by_class_name(DeprecatedFlyString const& class_names) +JS::NonnullGCPtr Element::get_elements_by_class_name(StringView class_names) { Vector 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) { diff --git a/Userland/Libraries/LibWeb/DOM/Element.h b/Userland/Libraries/LibWeb/DOM/Element.h index 0d0b68e386..090ef6b08e 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.h +++ b/Userland/Libraries/LibWeb/DOM/Element.h @@ -199,7 +199,7 @@ public: bool is_target() const; bool is_document_element() const; - JS::NonnullGCPtr get_elements_by_class_name(DeprecatedFlyString const&); + JS::NonnullGCPtr get_elements_by_class_name(StringView); bool is_shadow_host() const; ShadowRoot* shadow_root_internal() { return m_shadow_root.ptr(); }