Skip to content

18.2.8 breaks multiple selectors in :not on :host #58226

@LeonEck

Description

@LeonEck

Which @angular/* package(s) are the source of the bug?

compiler

Is this a regression?

Yes

Description

The following code used to work in 18.2.7

:host {
  &:not(&.foo, &.bar) {
    color: red;
  }
}

According to CSS Selectors 4 it is valid to put multiple selectors into one :not. With 18.2.8 we would need to chain two :nots together to get the same effect (&:not(&.foo):not(&.bar)). This somehow only seems to break on the host element.

Here is a reproduction with 18.2.8: https://stackblitz.com/edit/stackblitz-starters-3tx6cc?file=src%2Fmain.ts

Here is the same code with 18.2.7 where the first text has the expected color: https://stackblitz.com/edit/stackblitz-starters-oq4g3j?file=src%2Fmain.ts

Both have "inlineStyleLanguage": "scss" set (although that somehow doesn't seem to make a difference).

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 18.2.8
Node: 20.18.0
Package Manager: npm 10.9.0
OS: darwin arm64

Angular: 18.2.8
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, platform-browser, platform-browser-dynamic, router

Package Version

@angular-devkit/architect 0.1802.8
@angular-devkit/build-angular 18.2.8
@angular-devkit/core 18.2.8
@angular-devkit/schematics 18.2.8
@schematics/angular 18.2.8
ng-packagr 18.2.1
rxjs 7.8.1
typescript 5.5.4
zone.js 0.14.10

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions