Repository navigation
Fix prefixed gradients with uppercase keywords and units - #1566
Merged
Merged
Conversation
ai
reviewed
Nov 16, 2026
| * Lowercase case-insensitive CSS keywords and angle units | ||
| * in the first gradient argument | ||
| */ | ||
| lowerKeywords(nodes) { |
Member
There was a problem hiding this comment.
Move it to function, we do not need it as method
Contributor
Author
|
Done in b55a63a. |
Member
|
Thanks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1565
The gradient hack compared the function name,
to,atand angle units case-sensitively. CSS treats them case-insensitively. Solinear-gradient(TO RIGHT, red, blue)gave-webkit-gradient(linear, left top, left bottom, color-stop(RIGHT, TO), ...).90DEG,0.25TURN,1Radand100GRADwere not converted for old WebKit.ATin radial gradients was not moved.LINEAR-GRADIENT(...)got no prefixes.What changed in
lib/hacks/gradient.js:replace()matches the function name withtoLowerCase().lowerKeywords()lowercasesto,atand a leading angle with a unit in the first argument, before the existing conversion runs.Colors, stops and other words are not touched. The declaration the author wrote is never changed.
Behavior changes:
-webkit-linear-gradient(left, ...)forLINEAR-GRADIENT(to right, ...).Known limits:
calc()angles, comments inside the first argument and already prefixed input like-WEBKIT-LINEAR-GRADIENT(behave as before.Tests: I added
handles uppercase gradient keywords and unitstotest/autoprefixer.test.js. It fails on main. With the fix,npx uvu . '\.test\.js$'gives 274 passed, 0 failed, andoxlintreports no errors on my machine.Validated with Claude Opus 5.5.