angular-cn/packages/compiler
Pete Bacon Darwin 679c3bf7ea fix(compiler): handle `:host-context` and `:host` in the same selector (#40494)
In `ViewEncapsulation.Emulated` mode the compiler converts `:host` and
`:host-context` pseudo classes into new CSS selectors.

Previously, when there was both `:host-context` and `:host` classes in a
selector, the compiler was generating incorrect selectors. There are two
scenarios:

* Both classes are on the same element (i.e. not separated). E.g.
  `:host-context(.foo):host(.bar)`. This setup should only match the
  host element if it has both `foo` and `bar` classes. So the generated
  CSS selector should be: `.foo.bar<hostmarker>`.
* The `:host` class is on a descendant of the `:host-context`. E.g.
  `:host-context(.foo) :host(.bar)`. This setup should only match the
  `.foo` selector if it is a proper ancestor of the host (and not on the
  host itself). So the generated CSS selector should be:
  `.foo .bar<hostmarker>`.

This commit fixes the generation to handle these scenarios.

Fixes #14349

PR Close #40494
2021-02-16 08:41:19 -08:00
..
design docs: fix grammatical errors and typos (#38868) 2020-10-27 13:18:01 -07:00
src fix(compiler): handle `:host-context` and `:host` in the same selector (#40494) 2021-02-16 08:41:19 -08:00
test fix(compiler): handle `:host-context` and `:host` in the same selector (#40494) 2021-02-16 08:41:19 -08:00
testing build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
BUILD.bazel build: add npm_integration_test && angular_integration_test (#33927) 2020-02-24 08:59:18 -08:00
compiler.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
index.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
package.json Revert "build: remove wombot proxy registry from package.jsons for release (#37378)" (#37495) 2020-06-10 08:21:45 -07:00
public_api.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00