Skip to content

cascade-layers : container is an element specific conditional rule #610

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion plugins/postcss-cascade-layers/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
### Unreleased

- Fix broken `@keyframes` in `@layer`.
- Add support for `@container` as a conditional rule.

### 1.0.5 (July 8, 2022)

Expand Down
9 changes: 8 additions & 1 deletion plugins/postcss-cascade-layers/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down