Skip to content

Load and reflect imported stylesheets through live CSSOM #480

Closed
2 of 2 issues completed
Closed

Description

@wieslawsoltes

Problem

Dynamic CSSOM #239 now covers constructed/adopted sheets, replacement, nested style rules, media/supports/layer grouping, and owner-backed mutation. Imported stylesheets remain the explicit gap:

  • the compatibility adapter rejects insertRule('@import …'), drops imports during constructed replacement, and does not expose CSSImportRule;
  • linked stylesheet source is parsed natively without retaining the link owner/source for CSSOM reflection;
  • imported rules are not represented as child CSSStyleSheet objects, so live mutation, parent ownership, teardown, and imported base-URL behavior cannot work coherently.

Proposed implementation

  • Retain linked stylesheet source, resolved URL, and owner identity in native state and remove its rules when the owner disconnects.
  • Add browser-shaped CSSImportRule reflection (href, media, styleSheet, parentRule, parentStyleSheet, cssText) and a non-constructed child CSSStyleSheet.
  • Resolve imported sources through WebScene's existing stylesheet resource policy with bounded depth, byte, and cycle limits and correct nested base URLs.
  • Preserve import ordering and media wrapping, flatten only the native publication payload, and keep the authored/import CSSOM tree live.
  • Propagate imported rule/declaration/media mutations to the owning top-level sheet without altering owner DOM text.
  • Retire imported sheets and pending loads on deletion, owner detach, navigation, and realm teardown.

Acceptance and validation debt

Required before release promotion: pinned Chrome/WPT API and error parity; linked and inline imports; nested relative imports; media/layer/supports qualifiers; insertion/deletion and live child mutation; cycle/failure/cross-origin behavior; disconnect/reconnect/navigation; bounded latency, bytes, heap/RSS, native rule count, and publication queue.

Per the current implementation-throughput directive, implementation will merge without running those build/browser/native/performance/package/CI gates; all remain explicit debt.

Parent: #239. Coordination: #235, #243, #263, and vscode-demo#1.

Sub-issues

Sub-issues

2 of 2 Issues completed
Loading 2 sub-issues

Activity

  1. added
    vscode-oss/planned
    on Sep 18, 2026
  2. wieslawsoltes commented on Sep 18, 2026

    @wieslawsoltes
    CollaboratorAuthor

    Imported stylesheet support is complete as the merged stack #483 → #484.

    • Provider Resolve bounded imported stylesheets natively #483 merged as 7dd8e048bb45b07a12cfa5ddbe3ae732b001840f: bounded recursive @import loading through the existing stylesheet resource policy, nested URL rebasing, media/layer/supports qualifiers, linked owner/source/address identity, disconnect/reconnect retirement, and private source/loader hooks.
    • Cumulative top Expose live CSS import rule reflection #484 merged as a42b9da5fb40a585880518668f604735a5af2440: browser-shaped CSSImportRule, live child CSSStyleSheet ownership, nested relative imports, live declaration/rule/media mutation, flattened native publication without rewriting owner DOM text, deletion/detach semantics, runtime compatibility coverage, and a browser/native contract/profile.

    The stack closes #480/#481/#482 and the explicit imported-sheet remainder of #239. Per the implementation-throughput directive, the authored build/browser/native/WPT/performance/memory/lifecycle/package/CI gates were not run; that cumulative validation remains release debt.

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

    vscode-oss/planned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions