fix(css): improve parsing recovery when encountering qualified rules inside CSS @page at-rule blocks#8905
Conversation
…inside CSS at-rule blocks
🦋 Changeset detectedLatest commit: 65848a3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
WalkthroughThis PR adds parsing recovery support for CSS Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Merging this PR will not alter performance
Comparing Footnotes
|
Summary
closes #8428
This PR improves parsing recovery around the edge case where a user might try to use a CSS qualified rule inside an
@pageblock. According to the spec only a declaration rule list is allowed in a@pageblock which treats qualified rules as invalid. This PR makes it so that qualified rules are parsed but treated as invalid. This allows us to consume the qualified rule block which would otherwise break parsing since the closing curly brace of the qualified rule would be treated as the closing brace of the@pageblock and cascade parsing errors further.Note: the
div:hoverexample in the snapshot tests still kinda breaks a bit due to it potentially being confused with a declaration but I didn't want to over-engineer the solution here with something like speculative parsing withtry_parsesince this mostly covers and edge case.Test Plan
Snapshot tests
Docs
n/a
AI Usage Disclosure
I used Claude code to help explore the codebase and understand the problem a bit more and find existing solutions I could leverage, had it help me refine explanation comments, generate other test examples and double check my work but most of this was hand coded by me.