The original spec for constructable stylesheets allowed for calls to sheet.replace("@import('some.css');"). This use case is being removed - calls to replace() will throw an exception if @import rules are found in the replaced content. The CSS Working Group resolved to remove this feature on Feb 19, 2020: https://github.com/WICG/construct-stylesheets/issues/119#issuecomment-588352418. This feature was deprecated in M83, and will be removed in M84.

Motivation

There is an asymmetry between replaceSync(), which disallows @import rules, and replace(), which currently allows them. Additionally, work is underway on CSS Modules, which appear to be coalescing on also disallowing @imports for a first version, and (possibly) on a next version where @imports behave as leaves in the module tree. This would also be an asymmetry with the current replace() API. For these reasons, the CSS Working Group resolved to disallow @import in calls to replace().

Documentation

Specification

Editor's draft

Status in Chromium

Blink>CSS


Removed (tracking bug) in:

  • Chrome for desktop release 84
  • Chrome for Android release 84
  • Android WebView release 84

Consensus & Standardization

After a feature ships in Chrome, the values listed here are not guaranteed to be up to date.

  • No signal
  • No signal
  • No signal
  • No signals

Owner

Intent to Prototype url

Intent to Prototype thread

Search tags

CSSStyleSheet replace() @import,

Last updated on 2020-11-19