- From: Guillaume via GitHub <noreply@w3.org>
- Date: Thu, 22 Jan 2026 20:19:43 +0000
- To: public-css-archive@w3.org
I thought that a common algorithm for the rule block could prevent future inconsistencies.
> To **serialize a rule block** from
> an optional list of declarations `declarations`,
> an optional list of rules `rules`,
> and an optional `legacy` flag unset by default,
> run the following steps:
>
> 1. Let `string` be the string " {", i.e., a single SPACE (U+0020),
> followed by LEFT CURLY BRACKET (U+007B).
> 2. If `declarations` is not empty:
> 1. Append a single SPACE (U+0020).
> 2. If `declarations` is a [`CSSStyleDeclaration`](https://drafts.csswg.org/cssom-1/#cssstyledeclaration),
> append the result of getting its [`cssText`](https://drafts.csswg.org/cssom-1/#dom-cssstyledeclaration-csstext),
> otherwise append the result of serializing each declaration
> joined with the string "; ", i.e., SEMICOLON (U+003B) followed by a single SPACE (U+0020),
> and followed by the string ";", i.e., SEMICOLON (U+003B).
> 3. If `rules` is not empty:
> 1. Append a single SPACE (U+0020).
> 2. Append the result of getting the [`cssText`](https://drafts.csswg.org/cssom-1/#dom-cssrule-csstext) of each rule
> joined with a single SPACE (U+0020) if `legacy` is unset,
> otherwise with a newline followed by two SPACES (U+0020).
> 4. Append the string "}", i.e., RIGHT CURLY BRACKET (U+007D).
--
GitHub Notification of comment by cdoublev
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12959#issuecomment-3786511118 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Thursday, 22 January 2026 20:19:44 UTC