Skip to content
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

fix: cases with mixin moved compound selector #2397

Merged
merged 8 commits into from
Mar 20, 2022

Conversation

idoros
Copy link
Collaborator

@idoros idoros commented Mar 20, 2022

This PR fixes 2 issues:

1) ambiguity of a mixed-in CSS class and root class

The issue happens when a mixed class is compounded with .root:state (root class with custom-pseudo-class). The issue is that there is a bug in the process of mixin that loses the actual root symbol when a stylesheet class other then root is mixed:

mixin.st.css:

.root {
    -st-mixin: x;
}
.root:x.mix {
    color: green;
}

entry.st.css:

@st-import [mix] from "./mixin.st.css";

/* @rule[1] .entry__c.mixin__root.mixin--x */
.c {
    -st-mixin: mix;
}

valid selector: .entry__c.mixin__root.mixin--x
error selector: .entry__c.mixin__root:x // root symbol is "wrongly" replaced with mix class and :x custom-pseudo-state is unresolved

2) multiple compound selectors after mixin

When compound selectors are connected after mixin class, they need to move to the beginning of the selector with the mixin if it is moved:

mixin.st.css:

.root {
    -st-mixin: x;
}
.root.mix:mix-state {
    color: green;
}

entry.st.css:

@st-import [mix] from "./mixin.st.css";

/* @rule[1] .entry__c.mixin--mix-state.mixin__root */
.c {
    -st-mixin: mix;
}

valid selector: .entry__c.mixin--mix-state.mixin__root
error selector: .entry__c.mixin__root:mix-state // mix-state is not moved/transformed

@idoros idoros added bug Unexpected behavior or exception core Processing and transforming logic labels Mar 20, 2022
@idoros idoros requested a review from barak007 March 20, 2022 13:37
@idoros idoros changed the title fix: unknown dangling mixed-in root state fix: cases with moved compound selector Mar 20, 2022
@idoros idoros changed the title fix: cases with moved compound selector fix: cases with mixin moved compound selector Mar 20, 2022
@idoros idoros merged commit 2ee4073 into master Mar 20, 2022
@idoros idoros deleted the ido/fix-mixed-in-root-state branch March 20, 2022 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected behavior or exception core Processing and transforming logic
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants