Skip to content

Retain rules in nested declarations#1123

Open
mischnic wants to merge 1 commit intomasterfrom
mischnic/fix-nested-selector-list
Open

Retain rules in nested declarations#1123
mischnic wants to merge 1 commit intomasterfrom
mischnic/fix-nested-selector-list

Conversation

@mischnic
Copy link
Copy Markdown
Member

@mischnic mischnic commented Jan 8, 2026

Closes #1049

@mischnic mischnic requested a review from devongovett January 8, 2026 09:53
Comment thread src/rules/style.rs
// Merge any logical/conditional rules from nested declarations back into the parent context.
// These will be collected by the caller when generating additional rules for this style rule.
let child_context = std::mem::replace(&mut context.handler_context, handler_context);
context.handler_context.merge(child_context);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would have thought that when the nested rules get minified, the child context would get reset after the additional rules are generated. Seems like somehow that's not happening in this case?

Seems like the issue only occurs when the nested rules are before declarations, not after. This may have been caused when the spec got updated to allow intermixing rules and declarations (initially nested rules had to be after declarations). Now there is a hidden NestedDeclarations rule for these interleaved declarations. Maybe that case needs to be updated to work similarly to StyleRule (inserting additional rules after)? Otherwise what happens if you have nested rules followed by declarations followed by more rules? I guess the order of where those additional rules for logical properties get inserted might be important (right now they might all get pushed to the end)?

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.

logical border-radius removed when :where is present

2 participants