Skip to content

Commit 9ee8c8c

Browse files
committed
refactor(compiler): remove dedicated support for legacy shadow DOM selectors
Remove `_shadowDOMSelectorsRe` and `_convertShadowDOMSelectors` from `shadow_css.ts` so that `::shadow`, `::content`, `/shadow-deep/`, and `/shadow/` are no longer treated specially or stripped from user CSS. Instead, they are naturally scoped like standard selectors. Also remove the legacy failing test from `shadow_css_spec.ts`.
1 parent 7623580 commit 9ee8c8c

2 files changed

Lines changed: 0 additions & 21 deletions

File tree

packages/compiler/src/shadow_css.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,6 @@ export class ShadowCss {
466466
cssText = this._insertPolyfillHostInCssText(cssText);
467467
cssText = this._convertColonHost(cssText);
468468
cssText = this._convertColonHostContext(cssText);
469-
cssText = this._convertShadowDOMSelectors(cssText);
470469
if (scopeSelector) {
471470
cssText = this._scopeKeyframesRelatedCss(cssText, scopeSelector);
472471
cssText = this._scopeSelectors(cssText, scopeSelector, hostSelector);
@@ -666,14 +665,6 @@ export class ShadowCss {
666665
});
667666
}
668667

669-
/*
670-
* Convert combinators like ::shadow and pseudo-elements like ::content
671-
* by replacing with space.
672-
*/
673-
private _convertShadowDOMSelectors(cssText: string): string {
674-
return _shadowDOMSelectorsRe.reduce((result, pattern) => result.replace(pattern, ' '), cssText);
675-
}
676-
677668
// change a selector like 'div' to 'name div'
678669
private _scopeSelectors(cssText: string, scopeSelector: string, hostSelector: string): string {
679670
return processRules(cssText, (rule: CssRule) => {
@@ -1092,13 +1083,6 @@ const _polyfillHostNoCombinatorOutsidePseudoFunction = new RegExp(
10921083
'g',
10931084
);
10941085
const _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s,]*)/;
1095-
const _shadowDOMSelectorsRe = [
1096-
/::shadow/g,
1097-
/::content/g,
1098-
// Deprecated selectors
1099-
/\/shadow-deep\//g,
1100-
/\/shadow\//g,
1101-
];
11021086

11031087
// The deep combinator is deprecated in the CSS spec
11041088
// Support for `>>>`, `deep`, `::ng-deep` is then also deprecated and will be removed in the future.

packages/compiler/test/shadow_css/shadow_css_spec.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -322,11 +322,6 @@ describe('ShadowCss', () => {
322322
expect(shim('.pr\\fc fung {}', 'contenta')).toEqual('.pr\\fc fung[contenta] {}');
323323
});
324324

325-
it('should handle ::shadow', () => {
326-
const css = shim('x::shadow > y {}', 'contenta');
327-
expect(css).toEqualCss('x[contenta] > y[contenta] {}');
328-
});
329-
330325
it('should leave calc() unchanged', () => {
331326
const styleStr = 'div {height:calc(100% - 55px);}';
332327
const css = shim(styleStr, 'contenta');

0 commit comments

Comments
 (0)