-
Notifications
You must be signed in to change notification settings - Fork 25.7k
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
feat(compiler): scope selectors in @scope queries #50747
Conversation
93e0e8e
to
d8dac6d
Compare
d8dac6d
to
132af0a
Compare
Did a rebase to latest |
make sure selectors inside @scope queries are correctly scoped
132af0a
to
d5d72fe
Compare
Did a rebase to latest |
Will refrain from further rebases (unless stated to be required) since there is 1 approval and a few pending reviewers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Here is a StackBlitz to test scoping of the CSS scope at-rule: You can run the above example using Chrome with the Experimental Web Platform features flag enabled in chrome://flags/. On Angular 16.1.4 styles applied to This pull request should fix the style leak issue for the scope at-rule. Looks like support was pushed to Chrome 118 [1] instead of Chrome 117. |
Global Presubmit (internal-only link). |
Caretaker note: TGP is "green", this PR is ready for merge. |
This PR was merged into the repository by commit c27a1e6. |
Here is a StackBlitz to test scoping of the CSS scope at-rule with Angular 16.2.0-next.2: You can run the above example using Chrome with the Experimental Web Platform features flag enabled in chrome://flags/. I tested with: Version 117.0.5886.0 (Official Build) canary (64-bit) Styles are now correctly scoped. @scope ([data-scope='main-component']) to ([data-scope]) {
p[_ngcontent-ng-c3427923494] {
color: red;
}
section[_ngcontent-ng-c3427923494] {
background: snow;
}
}
@scope ([data-scope='sub-component']) to ([data-scope]) {
p[_ngcontent-ng-c3427923494] {
color: blue;
}
section[_ngcontent-ng-c3427923494] {
color: ghostwhite;
}
} Thank you for merging this feature. |
@puckowski thank you for contributing this feature and improving Angular 👍 |
make sure selectors inside @scope queries are correctly scoped PR Close angular#50747
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. |
make sure selectors inside @scope queries are correctly scoped PR Close angular#50747
make sure selectors inside @scope queries are correctly scoped PR Close angular#50747
This pull request makes sure selectors inside @scope queries are correctly scoped.
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: N/A
Currently there is no support in the Angular compiler for the scope at-rule CSSWG [1] which is targeted for support in Chrome 117 Chrome Status [2] which means usage of this feature results in CSS that is not correctly scoped.
What is the new behavior?
Using the CSS scope at-rule results in properly scoped CSS.
Does this PR introduce a breaking change?
Other information
Angular will be ready for the new browser features when they ship.