From 592cf556a1b9567e450cebc6c955dec6b5a860bb Mon Sep 17 00:00:00 2001 From: ronak69 Date: Mon, 14 Oct 2024 09:43:13 +0000 Subject: [PATCH] LibWeb/CSS: Don't serialize empty rules in CSSStyleRule This is a recent spec change: https://github.com/w3c/csswg-drafts/pull/10974 --- Userland/Libraries/LibWeb/CSS/CSSStyleRule.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Userland/Libraries/LibWeb/CSS/CSSStyleRule.cpp b/Userland/Libraries/LibWeb/CSS/CSSStyleRule.cpp index 0c798bddd8..1a0dea4a31 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSStyleRule.cpp +++ b/Userland/Libraries/LibWeb/CSS/CSSStyleRule.cpp @@ -94,6 +94,11 @@ String CSSStyleRule::serialized() const // 2. For each rule in rules: for (auto& rule : rules) { + // * If rule is the empty string, do nothing. + if (rule.is_empty()) + continue; + + // * Otherwise: // 1. Append a newline followed by two spaces to s. // 2. Append rule to s. builder.appendff("\n {}", rule);