Presenter: Don't give a style value if there are no styles

This commit is contained in:
Kyle Lanmon 2023-03-20 23:02:08 -05:00 committed by Andreas Kling
parent fcda397136
commit 244ea0fa9c
Notes: sideshowbarker 2024-07-16 22:33:51 +09:00

View File

@ -145,12 +145,15 @@ ErrorOr<void> HTMLElement::serialize(StringBuilder& builder) const
// FIXME: Escape the value string as necessary.
TRY(builder.try_appendff(" {}='{}'", key, value));
}
TRY(builder.try_append(" style=\""sv));
for (auto const& [key, value] : style) {
// FIXME: Escape the value string as necessary.
TRY(builder.try_appendff(" {}: {};", key, value));
if (!style.is_empty()) {
TRY(builder.try_append(" style=\""sv));
for (auto const& [key, value] : style) {
// FIXME: Escape the value string as necessary.
TRY(builder.try_appendff(" {}: {};", key, value));
}
TRY(builder.try_append("\""sv));
}
TRY(builder.try_append("\">"sv));
TRY(builder.try_append(">"sv));
if (!inner_text.is_empty())
TRY(builder.try_append(inner_text));
for (auto const& child : children) {