mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-20 09:49:15 +03:00
LibWeb: Stop adding extra whitespace when serializing CSS Functions
Otherwise `attr(|name, "fallback")` becomes `attr(| name , "fallback")` The test here is slightly aspirational. There are other rules for serialization we don't follow (like stripping whitespace entirely from many places) so these are marked with FIXMEs.
This commit is contained in:
parent
f31b39ca18
commit
0634d11318
Notes:
sideshowbarker
2024-07-18 22:57:59 +09:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/SerenityOS/serenity/commit/0634d11318 Pull-request: https://github.com/SerenityOS/serenity/pull/21162
8
Tests/LibWeb/Text/expected/css/attr-serialization.txt
Normal file
8
Tests/LibWeb/Text/expected/css/attr-serialization.txt
Normal file
@ -0,0 +1,8 @@
|
||||
attr(foo)
|
||||
attr( foo )
|
||||
attr(foo, "fallback")
|
||||
attr( foo , "fallback" )
|
||||
attr(foo string)
|
||||
attr( foo string )
|
||||
attr(foo string, "fallback")
|
||||
attr( foo string , "fallback" )
|
22
Tests/LibWeb/Text/input/css/attr-serialization.html
Normal file
22
Tests/LibWeb/Text/input/css/attr-serialization.html
Normal file
@ -0,0 +1,22 @@
|
||||
<script src="../include.js"></script>
|
||||
<script>
|
||||
test(() => {
|
||||
function serialize(input) {
|
||||
document.body.style.content = input;
|
||||
println(document.body.style.content);
|
||||
}
|
||||
|
||||
serialize('attr(foo)');
|
||||
// FIXME: This should produce `attr(foo)` but doesn't yet.
|
||||
serialize('attr( foo )');
|
||||
serialize('attr(foo, "fallback")');
|
||||
// FIXME: This should produce `attr(foo, "fallback")` but doesn't yet.
|
||||
serialize('attr( foo , "fallback" )');
|
||||
serialize('attr(foo string)');
|
||||
// FIXME: This should produce `attr(foo string)` but doesn't yet.
|
||||
serialize('attr( foo string )');
|
||||
serialize('attr(foo string, "fallback")');
|
||||
// FIXME: This should produce `attr(foo string, "fallback")` but doesn't yet.
|
||||
serialize('attr( foo string , "fallback" )');
|
||||
});
|
||||
</script>
|
@ -24,7 +24,8 @@ String Function::to_string() const
|
||||
|
||||
serialize_an_identifier(builder, m_name);
|
||||
builder.append('(');
|
||||
builder.join(' ', m_values);
|
||||
for (auto& item : m_values)
|
||||
builder.append(item.to_string());
|
||||
builder.append(')');
|
||||
|
||||
return MUST(builder.to_string());
|
||||
|
Loading…
Reference in New Issue
Block a user