Skip to content

Commit 467a39e

Browse files
Don’t move ::ng-deep pseudo element to end of selector when using @apply (#10943)
* Don’t move `::ng-deep` pseudo element * Update changelog
1 parent d731049 commit 467a39e

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

CHANGELOG.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10-
- Nothing yet!
10+
### Fixed
11+
12+
- Don’t move `::ng-deep` pseudo-element to end of selector when using `@apply` ([#10943](https://github.com/tailwindlabs/tailwindcss/pull/10943))
1113

1214
## [3.3.1] - 2023-03-30
1315

src/util/formatVariantSelector.js

+3
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,9 @@ let pseudoElementExceptions = [
337337
'::-webkit-scrollbar-track-piece',
338338
'::-webkit-scrollbar-corner',
339339
'::-webkit-resizer',
340+
341+
// Old-style Angular Shadow DOM piercing pseudo element
342+
'::ng-deep',
340343
]
341344

342345
/**

tests/apply.test.js

+30
Original file line numberDiff line numberDiff line change
@@ -2427,4 +2427,34 @@ crosscheck(({ stable, oxide }) => {
24272427
`)
24282428
})
24292429
})
2430+
2431+
stable.test('::ng-deep pseudo element is left alone', () => {
2432+
let config = {
2433+
darkMode: 'class',
2434+
content: [
2435+
{
2436+
raw: html` <div class="foo bar"></div> `,
2437+
},
2438+
],
2439+
}
2440+
2441+
let input = css`
2442+
::ng-deep .foo .bar {
2443+
@apply font-bold;
2444+
}
2445+
`
2446+
2447+
return run(input, config).then((result) => {
2448+
expect(result.css).toMatchFormattedCss(css`
2449+
::ng-deep .foo .bar {
2450+
font-weight: 700;
2451+
}
2452+
`)
2453+
})
2454+
})
2455+
2456+
// 1. `::ng-deep` is deprecated
2457+
// 2. It uses invalid selector syntax that Lightning CSS does not support
2458+
// It may be enough for Oxide to not support it at all
2459+
oxide.test.todo('::ng-deep pseudo element is left alone')
24302460
})

0 commit comments

Comments
 (0)