mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 05:47:35 +00:00
LibWeb: Fix string whitespace splitting mistake
`.split_view(Infra::ASCII_WHITESPACE)` tries to split the string view on the string "\t\n\f\r " (not any of the individual characters of that string). The correct way to split this string views here is `.split_view_if(Infra::is_ascii_whitespace)`, this is a little inconsistent with String, so probably should be addressed.
This commit is contained in:
parent
6bb3d4694f
commit
7c8ce42593
2 changed files with 2 additions and 2 deletions
|
@ -76,7 +76,7 @@ void DOMTokenList::associated_attribute_changed(StringView value)
|
|||
if (value.is_empty())
|
||||
return;
|
||||
|
||||
auto split_values = value.split_view(Infra::ASCII_WHITESPACE);
|
||||
auto split_values = value.split_view_if(Infra::is_ascii_whitespace);
|
||||
for (auto const& split_value : split_values)
|
||||
append_to_ordered_set(m_token_set, split_value);
|
||||
}
|
||||
|
|
|
@ -518,7 +518,7 @@ bool Element::is_active() const
|
|||
JS::NonnullGCPtr<HTMLCollection> Element::get_elements_by_class_name(FlyString const& class_names)
|
||||
{
|
||||
Vector<FlyString> list_of_class_names;
|
||||
for (auto& name : class_names.view().split_view(Infra::ASCII_WHITESPACE)) {
|
||||
for (auto& name : class_names.view().split_view_if(Infra::is_ascii_whitespace)) {
|
||||
list_of_class_names.append(name);
|
||||
}
|
||||
return HTMLCollection::create(*this, [list_of_class_names = move(list_of_class_names), quirks_mode = document().in_quirks_mode()](Element const& element) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue