Skip to content

Commit c827c86

Browse files
committed
Revert "fix(compiler): support commas in :host() argument"
This reverts commit 1e09bdc. Revert reason: the change relies on helper functions that do not exist in `20.3.x` branch (only exist in `main`).
1 parent f04cf22 commit c827c86

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

packages/compiler/src/shadow_css.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -511,13 +511,11 @@ export class ShadowCss {
511511
return cssText.replace(_cssColonHostRe, (_, hostSelectors: string, otherSelectors: string) => {
512512
if (hostSelectors) {
513513
const convertedSelectors: string[] = [];
514-
for (const hostSelector of this._splitOnTopLevelCommas(hostSelectors)) {
515-
const trimmedHostSelector = hostSelector.trim();
516-
if (!trimmedHostSelector) break;
514+
const hostSelectorArray = hostSelectors.split(',').map((p) => p.trim());
515+
for (const hostSelector of hostSelectorArray) {
516+
if (!hostSelector) break;
517517
const convertedSelector =
518-
_polyfillHostNoCombinator +
519-
trimmedHostSelector.replace(_polyfillHost, '') +
520-
otherSelectors;
518+
_polyfillHostNoCombinator + hostSelector.replace(_polyfillHost, '') + otherSelectors;
521519
convertedSelectors.push(convertedSelector);
522520
}
523521
return convertedSelectors.join(',');

packages/compiler/test/shadow_css/host_and_host_context_spec.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,6 @@ describe('ShadowCss, :host and :host-context', () => {
101101
expect(shim(':host:not(.foo, .bar) {}', 'contenta', 'a-host')).toEqualCss(
102102
'[a-host]:not(.foo, .bar) {}',
103103
);
104-
expect(shim(':host:not(:has(p, a)) {}', 'contenta', 'a-host')).toEqualCss(
105-
'[a-host]:not(:has(p, a)) {}',
106-
);
107-
expect(shim(':host(:not(.foo, .bar)) {}', 'contenta', 'a-host')).toEqualCss(
108-
'[a-host]:not(.foo, .bar) {}',
109-
);
110104
});
111105

112106
// see b/63672152

0 commit comments

Comments
 (0)