Skip to content

Match browser CSSStyleRule.cssText serialization after nested-rule mutation #432

Closed

Description

@wieslawsoltes

Problem

After #427 merged nested style-rule CSSOM, both Linux and macOS CI fail the existing stylesheet-cssom.test.mjs compatibility gate. The runtime now serializes:

[data-value="}"]::before {content: "a;{b}\""; background: url("data:image/svg+xml,<svg>{}</svg>")}

Chrome 153 serializes the same inserted rule as:

[data-value="}"]::before { content: "a;{b}\""; background: url("data:image/svg+xml,<svg>{}</svg>"); }

The current test expected input preservation and therefore also misses the browser-required final declaration semicolon. This blocks unrelated PRs before their native build.

Parent: #239. Tracking epics: #235 and #227.

Proposed fix

  • Make CSSStyleRule.cssText serialization browser-shaped for flat and nested live rules: one space inside each brace and a final semicolon for nonempty declaration blocks.
  • Preserve token boundaries, quoted braces, escapes, custom-property blocks, URLs, comments, and nested grouping.
  • Update the runtime compatibility assertion to the Chrome oracle instead of the original input string.
  • Cover mutation and replacement paths so cached/native/live wrappers agree.

Gates

  • Chrome/native exact serialization matrix for flat, nested, quoted, escaped, empty, and custom-property declarations.
  • Existing full runtime compatibility suite on Linux and macOS.
  • Adjacent Reflect and mutate nested CSS style rules for Code OSS #425 nested-rule CSSOM gate.
  • Bounded 256-rule serialization timing, heap/RSS, and repeated wrapper teardown.
    \n

Activity

  1. added
    bug
    vscode-oss/planned
    on Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugvscode-oss/planned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions