mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 06:48:49 +00:00
Everywhere: Add sv suffix to strings relying on StringView(char const*)
Each of these strings would previously rely on StringView's char const* constructor overload, which would call __builtin_strlen on the string. Since we now have operator ""sv, we can replace these with much simpler versions. This opens the door to being able to remove StringView(char const*). No functional changes.
This commit is contained in:
parent
e5f09ea170
commit
3f3f45580a
Notes:
sideshowbarker
2024-07-17 09:27:05 +09:00
Author: https://github.com/sin-ack
Commit: 3f3f45580a
Pull-request: https://github.com/SerenityOS/serenity/pull/14555
Reviewed-by: https://github.com/Dexesttp ✅
Reviewed-by: https://github.com/kleinesfilmroellchen
762 changed files with 8315 additions and 8316 deletions
|
@ -27,7 +27,7 @@ Vector<DOMStringMap::NameValuePair> DOMStringMap::get_name_value_pairs() const
|
|||
// in the order that those attributes are listed in the element's attribute list, add a name-value pair to list whose name is the attribute's name with the first five characters removed and whose value
|
||||
// is the attribute's value.
|
||||
m_associated_element->for_each_attribute([&](auto& name, auto& value) {
|
||||
if (!name.starts_with("data-"))
|
||||
if (!name.starts_with("data-"sv))
|
||||
return;
|
||||
|
||||
auto name_after_starting_data = name.view().substring_view(5);
|
||||
|
@ -102,7 +102,7 @@ DOM::ExceptionOr<void> DOMStringMap::set_value_of_new_named_property(String cons
|
|||
|
||||
// 3. Insert the string data- at the front of name.
|
||||
// NOTE: This is done out of order because StringBuilder doesn't have prepend.
|
||||
builder.append("data-");
|
||||
builder.append("data-"sv);
|
||||
|
||||
for (size_t character_index = 0; character_index < name.length(); ++character_index) {
|
||||
// 1. If name contains a U+002D HYPHEN-MINUS character (-) followed by an ASCII lower alpha, then throw a "SyntaxError" DOMException.
|
||||
|
@ -147,7 +147,7 @@ bool DOMStringMap::delete_existing_named_property(String const& name)
|
|||
|
||||
// 2. Insert the string data- at the front of name.
|
||||
// NOTE: This is done out of order because StringBuilder doesn't have prepend.
|
||||
builder.append("data-");
|
||||
builder.append("data-"sv);
|
||||
|
||||
for (auto character : name) {
|
||||
// 1. For each ASCII upper alpha in name, insert a U+002D HYPHEN-MINUS character (-) before the character and replace the character with the same character converted to ASCII lowercase.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue