mirror of https://github.com/artf/grapesjs.git
Browse Source
fix(parser): don't drop @container/@layer at-rules on CSS parse The browser CSS parser only recognised nestable at-rules (@container, @layer, ...) when the CSSOM reported a falsy rule `type`. That happened to work in Chrome, where the legacy `CSSRule.type` is `0` for newer at-rules, but engines that expose a real numeric type (jsdom reports `17` for `CSSContainerRule`) fell through every branch and the whole rule — selectors, styles and condition — was silently discarded. Detect nestable at-rules via `getNestableAtRule` regardless of the numeric `type`. `getNestableAtRule` already matches only when the rule's `cssText` starts with the exact `@<name>`, so normal style/keyframe rules are unaffected. The parsed condition keeps the container name and its query separated by a space, so the exported CSS is valid again (e.g. `@container somename (min-width: 300px){...}`). Fixes #5969 Co-authored-by: Claude Fable 5 <noreply@anthropic.com>release-v0.23.3
committed by
GitHub
3 changed files with 29 additions and 5 deletions
Loading…
Reference in new issue