Skip to content

fix(compiler): simplify handling of colon host with a selector list#68668

Open
mattrbeck wants to merge 1 commit into
angular:mainfrom
mattrbeck:refactor/simplify-colon-host-selector-list
Open

fix(compiler): simplify handling of colon host with a selector list#68668
mattrbeck wants to merge 1 commit into
angular:mainfrom
mattrbeck:refactor/simplify-colon-host-selector-list

Conversation

@mattrbeck
Copy link
Copy Markdown
Member

Update _convertColonHost to extract and use only the first argument from a :host(...) selector list, ignoring subsequent arguments instead of splitting and duplicating the selector list. Also remove the obsolete test cases from host_and_host_context_spec.ts.

Support for :host(.a, .b) has existed since d67f029 when the webcomponent polyfill was first designed, before the Shadow DOM spec was finalized. Selector lists in :host() never landed in the final spec, and it's a relic that Angular supports it today.

It's my belief that Angular should not have a special syntax here. I also believe that it's trivial for users of this syntax use :host(.a), :host(.b) or even :host(:is(.a, .b)) instead. This change updates the compiler to simply ignore all additional selectors in the :host().

@angular-robot angular-robot Bot added the area: compiler Issues related to `ngc`, Angular's template compiler label May 11, 2026
@ngbot ngbot Bot added this to the Backlog milestone May 11, 2026
Update `_convertColonHost` to extract and use only the first argument from a `:host(...)` selector list, ignoring subsequent arguments instead of splitting and duplicating the selector list. Also remove the obsolete test cases from `host_and_host_context_spec.ts`.
@mattrbeck mattrbeck force-pushed the refactor/simplify-colon-host-selector-list branch from 3ec47f5 to 417dea2 Compare May 11, 2026 02:10
@mattrbeck mattrbeck changed the title refactor(compiler): simplify handling of colon host with a selector list fix(compiler): simplify handling of colon host with a selector list May 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: compiler Issues related to `ngc`, Angular's template compiler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant