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.
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().
Specification being incubated in a Community Group
Status in Chromium
Consensus & Standardization
- No signal
- No signal
- No signals
Intent to Prototype urlIntent to Prototype thread
Search tagsCSSStyleSheet replace() @import,
Last updated on 2021-12-13