Skip to content

Commit e3a9d5f

Browse files
Don’t move unknown pseudo-elements to the end of selectors (#10962)
* Don’t move `::deep` pseudo element to end of selector when using `@apply` * Update changelog * Move pseudo-elements in two passes * Rewrite pseudo-element relocation logic * Update test `::test` is an unknown pseudo element and therefore may be actionable _and_ nestable * Add tests * Simplify tests * Simplify * run tests on CI multiple times This works around the timeouts/flakeyness of GitHub Actions * Update formatting * Add comment * Mark webkit peusdo elements as terminal * update comment * only execute the `global-setup` once * Simplify NO SORT FN YAY * Use typedefs * Update changelog * Update changelog * update again --------- Co-authored-by: Robin Malfait <[email protected]>
1 parent 467a39e commit e3a9d5f

16 files changed

+232
-157
lines changed

.github/workflows/ci-stable.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ jobs:
5050
run: npm run build
5151

5252
- name: Test
53-
run: npm run test
53+
run: |
54+
npm run test || \
55+
npm run test || \
56+
npm run test || exit 1
5457
5558
- name: Lint
5659
run: npm run style

.github/workflows/ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ jobs:
6666
run: npx turbo run build --filter=//
6767

6868
- name: Test
69-
run: npx turbo run test --filter=//
69+
run: |
70+
npx turbo run test --filter=// || \
71+
npx turbo run test --filter=// || \
72+
npx turbo run test --filter=// || exit 1
7073
7174
- name: Lint
7275
run: npx turbo run style --filter=//

.github/workflows/integration-tests-oxide.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,7 @@ jobs:
7878
run: npx turbo run build --filter=//
7979

8080
- name: Test ${{ matrix.integration }}
81-
run: npx turbo run test --filter=./integrations/${{ matrix.integration }}
81+
run: |
82+
npx turbo run test --filter=./integrations/${{ matrix.integration }} || \
83+
npx turbo run test --filter=./integrations/${{ matrix.integration }} || \
84+
npx turbo run test --filter=./integrations/${{ matrix.integration }} || exit 1

.github/workflows/integration-tests-stable.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,7 @@ jobs:
7777
run: npm run build
7878

7979
- name: Test ${{ matrix.integration }}
80-
run: npm run test --prefix ./integrations/${{ matrix.integration }}
80+
run: |
81+
npm run test --prefix ./integrations/${{ matrix.integration }} || \
82+
npm run test --prefix ./integrations/${{ matrix.integration }} || \
83+
npm run test --prefix ./integrations/${{ matrix.integration }} || exit 1

.github/workflows/prepare-release.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@ jobs:
6565
working-directory: standalone-cli
6666

6767
- name: Test
68-
run: npm test
68+
run: |
69+
npm test || \
70+
npm test || \
71+
npm test || exit 1
6972
working-directory: standalone-cli
7073

7174
- name: Release

.github/workflows/release-insiders-oxide.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,10 @@ jobs:
387387
run: npm run build
388388

389389
- name: Test
390-
run: npm test
390+
run: |
391+
npm test || \
392+
npm test || \
393+
npm test || exit 1
391394
392395
- name: 'Version based on commit: 0.0.0-${{ env.RELEASE_CHANNEL }}.${{ env.SHA_SHORT }}'
393396
run: npm version 0.0.0-${{ env.RELEASE_CHANNEL }}.${{ env.SHA_SHORT }} --force --no-git-tag-version

.github/workflows/release-insiders-stable.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ jobs:
4444
run: npm run build
4545

4646
- name: Test
47-
run: npm run test
47+
run: |
48+
npm run test || \
49+
npm run test || \
50+
npm run test || exit 1
4851
4952
- name: Resolve version
5053
id: vars

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Fixed
1111

12-
- Don’t move `::ng-deep` pseudo-element to end of selector when using `@apply` ([#10943](https://github.com/tailwindlabs/tailwindcss/pull/10943))
12+
- Don’t move unknown pseudo-elements to the end of selectors ([#10943](https://github.com/tailwindlabs/tailwindcss/pull/10943), [#10962](https://github.com/tailwindlabs/tailwindcss/pull/10962))
1313

1414
## [3.3.1] - 2023-03-30
1515

jest/global-setup.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
let { execSync } = require('child_process')
22

3+
let state = { ran: false }
34
module.exports = function () {
5+
if (state.ran) return
46
execSync('npm run build:rust', { stdio: 'ignore' })
57
execSync('npm run generate:plugin-list', { stdio: 'ignore' })
8+
state.ran = true
69
}

src/lib/expandApplyAtRules.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import parser from 'postcss-selector-parser'
44
import { resolveMatches } from './generateRules'
55
import escapeClassName from '../util/escapeClassName'
66
import { applyImportantSelector } from '../util/applyImportantSelector'
7-
import { collectPseudoElements, sortSelector } from '../util/formatVariantSelector.js'
7+
import { movePseudos } from '../util/pseudoElements'
88

99
/** @typedef {Map<string, [any, import('postcss').Rule[]]>} ApplyCache */
1010

@@ -566,13 +566,7 @@ function processApply(root, context, localCache) {
566566

567567
// Move pseudo elements to the end of the selector (if necessary)
568568
let selector = parser().astSync(rule.selector)
569-
selector.each((sel) => {
570-
let [pseudoElements] = collectPseudoElements(sel)
571-
if (pseudoElements.length > 0) {
572-
sel.nodes.push(...pseudoElements.sort(sortSelector))
573-
}
574-
})
575-
569+
selector.each((sel) => movePseudos(sel))
576570
rule.selector = selector.toString()
577571
})
578572
}

0 commit comments

Comments
 (0)