Skip to content

Conversation

@cdoublev
Copy link
Collaborator

The current algorithm definition requires adding two newlines:

  1. A single SPACE (U+0020), followed by the string "{", i.e., LEFT CURLY BRACKET (U+007B), followed by a newline.
  2. The result of performing serialize a CSS rule on each rule in the rule’s cssRules list, filtering out empty strings, indenting each item with two spaces, all joined with newline.
  3. A newline, followed by the string "}", i.e., RIGHT CURLY BRACKET (U+007D)

Based on WPT tests and the original commit of the current version, I think this is an obvious bugfix.

@cdoublev cdoublev added the cssom-1 Current Work label Jan 23, 2026
@tabatkins
Copy link
Member

While you're right this needs fixing, this particular fix breaks serilaization of non-empty rules, as it will put the } on the same line as the last declaration.

What needs to happen instead is the final newline should be moved into the step that serializes the contents and made dependent on that.

@cdoublev
Copy link
Collaborator Author

cdoublev commented Jan 23, 2026

Thanks for catching this mistake. I also applied an obvious bugfix for @keyframes serialization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cssom-1 Current Work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants