Sitelet https://web.archive.org/web/20220321073110/https://github.com/angular/angular/pull/40264
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(compiler): incorrectly encapsulating selectors with escape sequences #40264

Closed

Conversation

crisbeto
Copy link
Member

@crisbeto crisbeto commented Dec 25, 2020

CSS supports escaping in selectors, e.g. writing .foo:bar will match an element with the foo class and bar pseudo-class, but .foo\:bar will match the foo:bar class. Our shimmed shadow DOM encapsulation always assumes that : means a pseudo selector which breaks a selector like .foo\:bar.

These changes add some extra logic so that escaped characters in selectors are preserved.

Fixes #31844.

@google-cla google-cla bot added the cla: yes label Dec 25, 2020
@crisbeto crisbeto marked this pull request as ready for review Dec 25, 2020
@pullapprove pullapprove bot requested a review from AndrewKushnir Dec 25, 2020
@ngbot ngbot bot added this to the Backlog milestone Dec 25, 2020
@ngbot ngbot bot removed this from the Backlog milestone Dec 25, 2020
@ngbot ngbot bot removed this from the Backlog milestone Dec 25, 2020
@ngbot ngbot bot added this to the Backlog milestone Dec 25, 2020
Copy link
Contributor

@AndrewKushnir AndrewKushnir left a comment

LGTM, thanks for the fix @crisbeto 👍

packages/compiler/src/shadow_css.ts Outdated Show resolved Hide resolved
@AndrewKushnir
Copy link
Contributor

@AndrewKushnir AndrewKushnir commented Jan 6, 2021

CSS supports escaping in selectors, e.g. writing `.foo:bar` will match an element with the
`foo` class and `bar` pseudo-class, but `.foo\:bar` will match the `foo:bar` class. Our
shimmed shadow DOM encapsulation always assumes that `:` means a pseudo selector
which breaks a selector like `.foo\:bar`.

These changes add some extra logic so that escaped characters in selectors are preserved.

Fixes angular#31844.
@crisbeto crisbeto force-pushed the 31844-encapsulation-escape-characters branch from 053232c to 79c12bb Compare Jan 6, 2021
josephperrott added a commit that referenced this issue Jan 6, 2021
…ces (#40264)

CSS supports escaping in selectors, e.g. writing `.foo:bar` will match an element with the
`foo` class and `bar` pseudo-class, but `.foo\:bar` will match the `foo:bar` class. Our
shimmed shadow DOM encapsulation always assumes that `:` means a pseudo selector
which breaks a selector like `.foo\:bar`.

These changes add some extra logic so that escaped characters in selectors are preserved.

Fixes #31844.

PR Close #40264
@angular-automatic-lock-bot
Copy link

@angular-automatic-lock-bot angular-automatic-lock-bot bot commented Feb 6, 2021

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Feb 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants