Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don’t move ::ng-deep pseudo element to end of selector when using @apply #10943

Merged
merged 2 commits into from
Apr 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions src/util/formatVariantSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
]

/**
Expand Down
30 changes: 30 additions & 0 deletions tests/apply.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2427,4 +2427,34 @@ crosscheck(({ stable, oxide }) => {
`)
})
})

stable.test('::ng-deep pseudo element is left alone', () => {
let config = {
darkMode: 'class',
content: [
{
raw: html` <div class="foo bar"></div> `,
},
],
}

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')
})