1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:27:43 +00:00

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

View file

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