Skip to content

Fix transition with short time or easing before property - #1579

Open
Asimmirzac wants to merge 1 commit into
postcss:mainfrom
Asimmirzac:transition-time-first
Open

Asimmirzac wants to merge 1 commit into
postcss:mainfrom
Asimmirzac:transition-time-first

Conversation

@Asimmirzac

Copy link
Copy Markdown

In transition the time and the easing can go before the property name. Transition#findProp() supports it only if the first word starts with a digit, so a shorter .3s (minifiers print it this way) or an easing keyword hides the property and Autoprefixer does not add prefixes.

For safari 17:

a { transition: 0.3s backdrop-filter }      /* prefixed */
a { transition: .3s backdrop-filter }       /* not prefixed */
a { transition: ease .3s backdrop-filter }  /* not prefixed */
a { transition: 0.3s ease backdrop-filter } /* not prefixed */

Removing outdated prefixes had the same problem: for chrome 100, .3s -webkit-transform, .3s transform kept -webkit-transform, but 0.3s -webkit-transform, 0.3s transform did not.

Now findProp() takes the first word which is not a time and not an easing keyword. If there is no such word, it returns the first token as before.

Behavior change: only values where the property name is not the first word. I compared the old and new code on 728 orderings of property, time and easing for 3 browser lists (2184 runs). The output changed in 300 of them, never for a value with the name in the first place, and every ordering now gets the same prefixes as the name-first one.

Tests: added .revert-short and .revert-easing to test/cases/transition.css. All 289 tests pass, 3 of them fail with the old lib/transition.js. oxlint and oxfmt --check are clean on lib/transition.js.

Prepared with AI assistance (Claude Code).

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ai

ai commented Nov 30, 2026

Copy link
Copy Markdown
Member

Do you have a real use case for that? transition as I assume don't need prefixes for new browsers anymore, so why we need to complicated code?

@Asimmirzac

Copy link
Copy Markdown
Author

No, I have no report from a real project. I found it by comparing the output for different orders of the same value.

Where it can matter today: backdrop-filter needs -webkit- in Safari before 18, so transition: .3s backdrop-filter is not prefixed there while 0.3s backdrop-filter is. You are right that most properties do not need prefixes in transition anymore, and most people write the property name first.

If that is too little to justify the change, feel free to close this.

Prepared with AI assistance (Claude Code).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants