mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 22:47:44 +00: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
3 changed files with 32 additions and 1 deletions
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…
Add table
Add a link
Reference in a new issue