Repository navigation
Commit 1f18d20
Handle vendor-prefixed selector functions in custom variants (#20486)
Fixes #20483.
## What changed
- parse `:-moz-any()` and `:-webkit-any()` arguments as selector lists,
matching their standard `:is()` counterpart
- allow nesting replacement to substitute `&` inside these legacy
selector functions
- cover both vendor-prefixed parser forms and the reported
`@custom-variant firefox (:-moz-any(&))` compilation path
## Why
The selector parser treated unknown function arguments as opaque values.
After the nesting changes in #20124, that meant the `&` inside
`:-moz-any(&)` could not be replaced and the custom variant was emitted
as a descendant selector instead.
These two vendor-prefixed functions are legacy aliases for selector-list
matching, so handling them alongside `:is()` keeps the change narrowly
scoped.
## Validation
- reproduced the regression on current `main`: `.firefox\\:underline
:-moz-any(:scope)`
- confirmed the new assertions fail when only the parser change is
reverted
- `vitest run packages/tailwindcss/src/index.test.ts
packages/tailwindcss/src/selector-parser.test.ts` — 299 tests passed
- Prettier check passed for all changed files
- `tailwindcss` production build passed, including ESM, CJS, and
declaration output
---------
Co-authored-by: Robin Malfait <[email protected]>1 parent 955d37a commit 1f18d20
4 files changed
Lines changed: 48 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4211 | 4211 | | |
4212 | 4212 | | |
4213 | 4213 | | |
| 4214 | + | |
| 4215 | + | |
| 4216 | + | |
| 4217 | + | |
| 4218 | + | |
| 4219 | + | |
| 4220 | + | |
| 4221 | + | |
| 4222 | + | |
| 4223 | + | |
| 4224 | + | |
| 4225 | + | |
| 4226 | + | |
| 4227 | + | |
| 4228 | + | |
| 4229 | + | |
| 4230 | + | |
| 4231 | + | |
| 4232 | + | |
| 4233 | + | |
| 4234 | + | |
| 4235 | + | |
| 4236 | + | |
4214 | 4237 | | |
4215 | 4238 | | |
4216 | 4239 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
284 | 284 | | |
285 | 285 | | |
286 | 286 | | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
287 | 308 | | |
288 | 309 | | |
289 | 310 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
394 | 394 | | |
395 | 395 | | |
396 | 396 | | |
397 | | - | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
398 | 400 | | |
399 | 401 | | |
400 | 402 | | |
| |||
0 commit comments