Skip to content

Commit f689269

Browse files
mattrbeckthePunderWoman
authored andcommitted
Revert "fix(compiler): support one additional level of nesting in :host()"
This reverts commit 036c5d2.
1 parent 7b2e6ca commit f689269

File tree

2 files changed

+1
-10
lines changed

2 files changed

+1
-10
lines changed

packages/compiler/src/shadow_css.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,13 +1045,7 @@ const _cssContentUnscopedRuleRe =
10451045
const _polyfillHost = '-shadowcsshost';
10461046
// note: :host-context pre-processed to -shadowcsshostcontext.
10471047
const _polyfillHostContext = '-shadowcsscontext';
1048-
// Matches text content with no parentheses, e.g., "foo"
1049-
const _noParens = '[^)(]*';
1050-
// Matches content with at most ONE level of nesting, e.g., "a(b)c"
1051-
const _level1Parens = String.raw`(?:\(${_noParens}\)|${_noParens})+?`;
1052-
// Matches content with at most TWO levels of nesting, e.g., "a(b(c)d)e"
1053-
const _level2Parens = String.raw`(?:\(${_level1Parens}\)|${_noParens})+?`;
1054-
const _parenSuffix = String.raw`(?:\((${_level2Parens})\))`;
1048+
const _parenSuffix = '(?:\\((' + '(?:\\([^)(]*\\)|[^)(]*)+?' + ')\\))';
10551049
const _cssColonHostRe = new RegExp(_polyfillHost + _parenSuffix + '?([^,{]*)', 'gim');
10561050
// note: :host-context patterns are terminated with `{`, as opposed to :host which
10571051
// is both `{` and `,` because :host-context handles top-level commas differently.

packages/compiler/test/shadow_css/host_and_host_context_spec.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,6 @@ describe('ShadowCss, :host and :host-context', () => {
8383
expect(shim(':host(:not(p)):before {}', 'contenta', 'a-host')).toEqualCss(
8484
'[a-host]:not(p):before {}',
8585
);
86-
expect(shim(':host(:not(:has(p))) {}', 'contenta', 'a-host')).toEqualCss(
87-
'[a-host]:not(:has(p)) {}',
88-
);
8986
expect(shim(':host:not(:host.foo) {}', 'contenta', 'a-host')).toEqualCss(
9087
'[a-host]:not([a-host].foo) {}',
9188
);

0 commit comments

Comments
 (0)