From 827170f6e6a73d5069ac80a78fc161e209b6ad5d Mon Sep 17 00:00:00 2001 From: Shannon Booth Date: Tue, 12 Sep 2023 22:34:25 +1200 Subject: [PATCH] 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. --- Userland/Libraries/LibWeb/DOM/Document.cpp | 4 ++-- Userland/Libraries/LibWeb/DOM/Document.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index 242662e5ee..703b90672a 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -1189,10 +1189,10 @@ JS::NonnullGCPtr Document::get_elements_by_name(DeprecatedString }); } -JS::NonnullGCPtr Document::get_elements_by_class_name(DeprecatedFlyString const& class_names) +JS::NonnullGCPtr Document::get_elements_by_class_name(StringView class_names) { Vector 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) { diff --git a/Userland/Libraries/LibWeb/DOM/Document.h b/Userland/Libraries/LibWeb/DOM/Document.h index e636661ea2..309ee6ea7b 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.h +++ b/Userland/Libraries/LibWeb/DOM/Document.h @@ -217,7 +217,7 @@ public: void schedule_layout_update(); JS::NonnullGCPtr get_elements_by_name(DeprecatedString const&); - JS::NonnullGCPtr get_elements_by_class_name(DeprecatedFlyString const&); + JS::NonnullGCPtr get_elements_by_class_name(StringView); JS::NonnullGCPtr applets(); JS::NonnullGCPtr anchors();