Repository navigation
Prefix background-clip: text when it is one of several layers - #1581
Open
JohanesPeterV wants to merge 1 commit into
Open
JohanesPeterV wants to merge 1 commit into
JohanesPeterV wants to merge 1 commit into
Conversation
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.
background-clip: textgets-webkit-background-clip, but the same keyword in a list of layers doesn't. A list liketext, border-boxis how you put gradient text on a solid background with one element.BackgroundClip#check()compares the whole value withtext, sotext, border-boxnever matches. Browsers that still need the prefix (Chrome before 120, which the default Browserslist still includes as Chrome 109) drop the unprefixed declaration, so the gradient fills the whole box instead of the letters.Input CSS
Current output CSS
Same as the input. No
-webkit-background-clip.Output after the fix
check()now splits the value withlist.comma()and prefixes when any layer istext.Behavior change: only
background-cliplists with atextlayer.textinside a function likevar(--clip, text)is still left alone, and Chrome 120+ gets no prefix, same as the single keyword.Autoprefixer 10.7.1, default Browserslist.
Before (
main):before.mp4
After:
after.mp4
Tests: added an
h1case totest/cases/background-clip.cssand.out.css. Onmainthat case fails (288 of 289 pass). With the fix,pnpm testpasses: 289 tests, 100% line coverage, oxlint and size-limit.oxfmt --checkis clean on the changed file.Found and fixed with AI help (GPT-6.2 Astra in Codex, Claude Opus 5.5 in Claude Code).