Skip to content

fix: restore declarations for incompatible selectors after rule merge - #1275

Open
PranavAchar01 wants to merge 3 commits into
parcel-bundler:masterfrom
PranavAchar01:fix/1260-incompatible-selector-merge-drops-declarations
Open

fix: restore declarations for incompatible selectors after rule merge#1275
PranavAchar01 wants to merge 3 commits into
parcel-bundler:masterfrom
PranavAchar01:fix/1260-incompatible-selector-merge-drops-declarations

Conversation

@PranavAchar01

@PranavAchar01 PranavAchar01 commented Jun 9, 2026

Copy link
Copy Markdown

merge_style_rules(rule) = compatible(rule.selectors) → prev.declarations ∪ rule.declarations
| incompatible(rule.selectors) → clone(rule) with rule.declarations preserved
https://drafts.csswg.org/selectors-4/#has-pseudo

Fixes: #1260

PranavAchar01 and others added 2 commits June 9, 2026 13:30
…s them

When a style rule has both compatible and incompatible selectors for the
current targets, merge_style_rules drains the rule's declarations into the
preceding compatible rule. This left the incompatible-selector clones
with empty declarations, causing them to be silently dropped by is_empty().

Fix: snapshot the declarations before the merge attempt and restore them
into each incompatible-selector clone.

Fixes parcel-bundler#1260.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 4, 2026 20:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incompatible selectors can be dropped after rule merging when targets require selector splitting

2 participants