Repository navigation
Commit d1e84fa
committed
fix(css): read an rgb()'s separator grammar before folding it
`_minifyColorFunction` cuts on whitespace, `,` and `/` in one pass without
recording which separator stood where, so every spelling collapsed to the
same argument list: `rgb(1, 2 3)`, `rgb(1 2, 3)`, `rgb(1 2 3, .5)`,
`rgb(1, 2, 3 / .5)`, `rgb(1 2 3 .5)` and `rgb(1 / 2 / 3)` all folded to a
color. Each is a declaration an engine drops, so folding it changed what
rendered.
This is the defect #22242 fixed for `hsl()`, `hwb()` and the Lab family,
left out of that change because `rgb()` reads its arguments through a
scanner of its own. The same two grammars decide it — the modern `A B C`
with an optional `/ D`, and the legacy `A, B, C` with an optional `, D`,
both of which `rgb()` has — so the check is the pair of regexps that change
already added, applied after the scan rather than before it, where only a
plausible color reaches it.
The pending changeset for #22242 covers this, so it is widened rather than
duplicated.1 parent e2023b0 commit d1e84fa
5 files changed
Lines changed: 29 additions & 1 deletion
File tree
- .changeset
- lib/css
- test/configCases/css/minimize-colors
- __snapshots__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7938 | 7938 | | |
7939 | 7939 | | |
7940 | 7940 | | |
| 7941 | + | |
| 7942 | + | |
| 7943 | + | |
| 7944 | + | |
| 7945 | + | |
| 7946 | + | |
| 7947 | + | |
| 7948 | + | |
7941 | 7949 | | |
7942 | 7950 | | |
7943 | 7951 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
69 | 74 | | |
70 | 75 | | |
71 | 76 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
69 | 74 | | |
70 | 75 | | |
71 | 76 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
136 | 146 | | |
137 | 147 | | |
138 | 148 | | |
| |||
0 commit comments