fix(compiler): ignore host-context when invoked without parentheses#68664
Open
mattrbeck wants to merge 1 commit into
Open
fix(compiler): ignore host-context when invoked without parentheses#68664mattrbeck wants to merge 1 commit into
mattrbeck wants to merge 1 commit into
Conversation
8b53c6e to
7b288ee
Compare
da0f5bf to
1ea9942
Compare
…text Modify `_colonHostContextRe` and `_hostContextPattern` to strictly process `:host-context` only when parentheses containing at least one non-whitespace argument character are present. Update `_colonHostRe` to explicitly NOT match `:host` when followed by a hyphen. When invoked without parentheses or with empty parentheses, the selector is completely ignored and treated as a standard CSS pseudo-class in the source text. Also update the legacy test case from `host_and_host_context_spec.ts`.
1ea9942 to
a84ae23
Compare
JoostK
approved these changes
May 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Modify
_colonHostContextReand_hostContextPatternto strictly process:host-contextonly when parentheses are present. When invoked without parentheses (which is invalid), the selector is ignored and preserved in the source text. Also remove the legacy test case fromhost_and_host_context_spec.ts.Support for this behavior was introduced in 2021 in #40494 with the following comment:
I believe giving this invalid selector special meaning was a mistake, and that Angular should not diverge from the spec in this particular case. Any code this impacts can be trivially migrated to use
:hostto produce the same result.