-
Notifications
You must be signed in to change notification settings - Fork 26.3k
fix(compiler): fix pseudo-selector parsing issues #58557
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(compiler): fix pseudo-selector parsing issues #58557
Conversation
fix several use-cases where `:host` was used in or around pseudo-selectors - `:host` followed by a comma inside pseudo-selectors - `:host` outside of pseudo-selectors when another `:host` is present within see tests for examples
fix transformation logic for `:where` and `:is` pseudo-selectors when these selectors were used in a chain. results were often broken, the last letter of the selector was incorrectly trimmed. see tests for examples Fixes angular#58226
fix results which had to parse several `-shadowcsshost-no-combinator` occurrences in a single selector
multiline selectors where not correctly recognized by the regexp, fix it to fetch newlines as well Fixes angular#58399
Passed TGP |
@GeorgySerga I tested your change and the first regression that I reported in #58226 is still present. Given this code: :host {
&:not(&.foo, &.bar) {
color: red;
}
} It produces the following in your PR: [_nghost-%COMP%]:not([_nghost-%COMP%].foo,.bar[_nghost-%COMP%]){color:red} It previously produced this: [_nghost-%COMP%]:not([_nghost-%COMP%] .foo, .bar)[_nghost-%COMP%]{color:red} Since the changes in 18.2.8 have only been reverted on the 18 branch and not for 19, we would currently see the same regression again. I noticed that you added a test for this case. Is the new output now the one you consider correct? Is this change now intentional? In which case this should be marked and documented as a breaking change. |
@LeonEck fwiw, the breaking change window for v19 is now closed. Either we're able to land a non-breaking fix or this fix will also be reverted in v19 (until a non-breaking one can land). |
Hi @LeonEck , thank you! I don't think I quite understand the example you shared. If I understand correctly
should be (after sass conversion)
(a Could you please share more? Thanks! |
I added several variations of those selectors into the tests here as well, so you can take a look: https://github.com/angular/angular/pull/58557/files#diff-874bc712ebc9efc52417f6e744bd2b118514d58405dd2c31df0ae467ff297840R86-R100 . |
@GeorgySerga I think the |
Thank you @LeonEck ! Addressing this part
Styles apply regardless of order in this case |
I edited your example so it includes the whole output that Angular produces: https://jsbin.com/rirogosiri/edit?html,css,output The The |
It does not, indeed, but it is correct. Both elements there have classes applied: EDIT: added a link to a bin with class applied if the host has a different class, |
@GeorgySerga I've opened #58681 with your commits as we want to target the |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: #58226
What is the new behavior?
:where
and:is
with attached selectors of other types are parsed as all other selectors. If selectors consist only of those two than each of them is scoped separately (recursively) and result is returned backDoes this PR introduce a breaking change?
Other information