From d60a496c462c423d5e8705c2957c58a00009807b Mon Sep 17 00:00:00 2001 From: romainmenke Date: Tue, 6 Sep 2022 23:15:56 +0200 Subject: [PATCH] cascade-layers : container is an element specific conditional rule --- plugins/postcss-cascade-layers/CHANGELOG.md | 1 - plugins/postcss-cascade-layers/src/constants.ts | 9 ++++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/postcss-cascade-layers/CHANGELOG.md b/plugins/postcss-cascade-layers/CHANGELOG.md index 94c09412c..87c9b2c7f 100644 --- a/plugins/postcss-cascade-layers/CHANGELOG.md +++ b/plugins/postcss-cascade-layers/CHANGELOG.md @@ -3,7 +3,6 @@ ### Unreleased - Fix broken `@keyframes` in `@layer`. -- Add support for `@container` as a conditional rule. ### 1.0.5 (July 8, 2022) diff --git a/plugins/postcss-cascade-layers/src/constants.ts b/plugins/postcss-cascade-layers/src/constants.ts index ddf3bcecf..c4726357a 100644 --- a/plugins/postcss-cascade-layers/src/constants.ts +++ b/plugins/postcss-cascade-layers/src/constants.ts @@ -6,10 +6,17 @@ export const WITH_SELECTORS_LAYER_NAME = 'csstools-layer-with-selector-rules'; export const ANONYMOUS_LAYER_SUFFIX = '6efdb677-bb05-44e5-840f-29d2175862fd'; export const IMPLICIT_LAYER_SUFFIX = 'b147acf6-11a6-4338-a4d0-80aef4cd1a2f'; +// https://drafts.csswg.org/css-cascade-5/#layer-ordering +// Layers that are defined inside of a conditional group rule do not contribute to the layer order +// unless the condition is true or unless the conditional group rule can evaluate differently for different elements in the document. +// +// Since the layer order is global to the document, +// any layers defined inside an element-sensitive conditional group rule need to be accommodated +// when establishing the global layer order, regardless of the rule’s condition. +// Conditions that are global to the document, however (such as @media and @supports) can accommodate such @layer rules conditionally. export const CONDITIONAL_ATRULES = [ 'media', 'supports', - 'container', ]; export const ATRULES_WITH_NON_SELECTOR_BLOCK_LISTS = [