From 467a39e0d59a9fdc42deef3a9c7d51c44ace90e8 Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Tue, 4 Apr 2023 12:46:20 -0400 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20move=20`::ng-deep`=20pseudo=20e?= =?UTF-8?q?lement=20to=20end=20of=20selector=20when=20using=20`@apply`=20(?= =?UTF-8?q?#10943)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Don’t move `::ng-deep` pseudo element * Update changelog --- CHANGELOG.md | 4 +++- src/util/formatVariantSelector.js | 3 +++ tests/apply.test.js | 30 ++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 84a93b630..ebd2f590c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -- Nothing yet! +### Fixed + +- Don’t move `::ng-deep` pseudo-element to end of selector when using `@apply` ([#10943](https://github.com/tailwindlabs/tailwindcss/pull/10943)) ## [3.3.1] - 2023-03-30 diff --git a/src/util/formatVariantSelector.js b/src/util/formatVariantSelector.js index 8a1a3f50c..8857d8fc5 100644 --- a/src/util/formatVariantSelector.js +++ b/src/util/formatVariantSelector.js @@ -337,6 +337,9 @@ let pseudoElementExceptions = [ '::-webkit-scrollbar-track-piece', '::-webkit-scrollbar-corner', '::-webkit-resizer', + + // Old-style Angular Shadow DOM piercing pseudo element + '::ng-deep', ] /** diff --git a/tests/apply.test.js b/tests/apply.test.js index 0ab9ec175..15cb41768 100644 --- a/tests/apply.test.js +++ b/tests/apply.test.js @@ -2427,4 +2427,34 @@ crosscheck(({ stable, oxide }) => { `) }) }) + + stable.test('::ng-deep pseudo element is left alone', () => { + let config = { + darkMode: 'class', + content: [ + { + raw: html`
`, + }, + ], + } + + let input = css` + ::ng-deep .foo .bar { + @apply font-bold; + } + ` + + return run(input, config).then((result) => { + expect(result.css).toMatchFormattedCss(css` + ::ng-deep .foo .bar { + font-weight: 700; + } + `) + }) + }) + + // 1. `::ng-deep` is deprecated + // 2. It uses invalid selector syntax that Lightning CSS does not support + // It may be enough for Oxide to not support it at all + oxide.test.todo('::ng-deep pseudo element is left alone') })