Skip to content

Commit 194f723

Browse files
committed
fix(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`. (cherry picked from commit 6de4955)
1 parent 4c25a42 commit 194f723

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
@@ -417,7 +417,6 @@ export class ShadowCss {
417417
cssText = this._insertPolyfillHostInCssText(cssText);
418418
cssText = this._convertColonHost(cssText);
419419
cssText = this._convertColonHostContext(cssText);
420-
cssText = this._convertShadowDOMSelectors(cssText);
421420
if (scopeSelector) {
422421
cssText = this._scopeKeyframesRelatedCss(cssText, scopeSelector);
423422
cssText = this._scopeSelectors(cssText, scopeSelector, hostSelector);
@@ -590,14 +589,6 @@ export class ShadowCss {
590589
});
591590
}
592591

593-
/*
594-
* Convert combinators like ::shadow and pseudo-elements like ::content
595-
* by replacing with space.
596-
*/
597-
private _convertShadowDOMSelectors(cssText: string): string {
598-
return _shadowDOMSelectorsRe.reduce((result, pattern) => result.replace(pattern, ' '), cssText);
599-
}
600-
601592
// change a selector like 'div' to 'name div'
602593
private _scopeSelectors(cssText: string, scopeSelector: string, hostSelector: string): string {
603594
return processRules(cssText, (rule: CssRule) => {
@@ -1011,13 +1002,6 @@ const _polyfillHostNoCombinatorOutsidePseudoFunction = new RegExp(
10111002
'g',
10121003
);
10131004
const _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s,]*)/;
1014-
const _shadowDOMSelectorsRe = [
1015-
/::shadow/g,
1016-
/::content/g,
1017-
// Deprecated selectors
1018-
/\/shadow-deep\//g,
1019-
/\/shadow\//g,
1020-
];
10211005

10221006
// The deep combinator is deprecated in the CSS spec
10231007
// 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)