mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-10 10:09:14 +00:00
LibWeb/CSS: Remove unwanted newline from list serialization
Gets us 1 subtest pass.
This commit is contained in:
parent
8cdb8ca193
commit
917d659f8b
Notes:
github-actions[bot]
2024-11-30 10:03:16 +00:00
Author: https://github.com/AtkinsSJ
Commit: 917d659f8b
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2638
2 changed files with 7 additions and 4 deletions
|
@ -31,14 +31,17 @@ String serialize_a_string(StringView string);
|
|||
String serialize_a_url(StringView url);
|
||||
String serialize_a_srgb_value(Color color);
|
||||
|
||||
// https://www.w3.org/TR/cssom/#serialize-a-comma-separated-list
|
||||
template<typename T, typename SerializeItem>
|
||||
void serialize_a_comma_separated_list(StringBuilder& builder, Vector<T> const& items, SerializeItem serialize_item)
|
||||
{
|
||||
// To serialize a comma-separated list concatenate all items of the list in list order
|
||||
// while separating them by ", ", i.e., COMMA (U+002C) followed by a single SPACE (U+0020).
|
||||
for (size_t i = 0; i < items.size(); i++) {
|
||||
auto& item = items.at(i);
|
||||
serialize_item(builder, item);
|
||||
if ((i + 1) < items.size()) {
|
||||
builder.append(",\n"sv);
|
||||
builder.append(", "sv);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue