Skip to content

fix(compiler): support one additional level of nesting in :host()#64937

Merged
thePunderWoman merged 1 commit intoangular:mainfrom
mattrbeck:i64830_easy
Nov 6, 2025
Merged

fix(compiler): support one additional level of nesting in :host()#64937
thePunderWoman merged 1 commit intoangular:mainfrom
mattrbeck:i64830_easy

Conversation

@mattrbeck
Copy link
Member

Previously we supported one level of nested parentheses inside of a :host() selector, e.g. :host(:not(p)). This caused a breakage in g3 when I migrated a selector from :host:not(:has(p)) to :host(:not(:has(p))). This change adds support for just one more level of nesting.

It'd be nice to move everything to a real CSS parser (or even update it to count parentheses like I did with :host-context()), but I wasn't able to get that to work in ~20 minutes and I'm focusing on other things at the moment.

This change punts the problem until somebody tries to use just one more level of nesting in a selector.

Fixes #64830

Does this PR introduce a breaking change?

  • Yes
  • No
  • Only as much as any CSS change is technically breaking. I doubt it in this case, but I'll run a TGP.

Previously we supported one level of nested parentheses inside of a
`:host()` selector, e.g. `:host(:not(p))`. This caused a breakage in g3
when I migrated a selector from `:host:not(:has(p))` to
`:host(:not(:has(p)))`. This change adds support for just one more level
of nesting.

It'd be nice to move everything to a real CSS parser (or even update it
to count parentheses like I did with :host-context()), but I wasn't able
to get that to work in ~20 minutes and I'm focusing on other things at
the moment.

This change punts the problem until somebody tries to use just one more
level of nesting in a selector.

Fixes angular#64830
@angular-robot angular-robot bot added the area: compiler Issues related to `ngc`, Angular's template compiler label Nov 5, 2025
@ngbot ngbot bot added this to the Backlog milestone Nov 5, 2025
@mattrbeck mattrbeck requested a review from crisbeto November 6, 2025 03:22
@mattrbeck
Copy link
Member Author

All failing tests appear to be flakes that TAP hasn't flagged yet: http://test/OCL:828662614:BASE:828981196:1762449004064:76d871a9

@mattrbeck mattrbeck added action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release labels Nov 6, 2025
@thePunderWoman thePunderWoman merged commit 4441437 into angular:main Nov 6, 2025
23 checks passed
@thePunderWoman
Copy link
Contributor

This PR was merged into the repository. The changes were merged into the following branches:

@angular-automatic-lock-bot
Copy link

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 Dec 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: compiler Issues related to `ngc`, Angular's template compiler target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nested pseudo-elements in :host produce invalid selector

3 participants