Skip to content

Remove outdated prefixed values before a different unprefixed value - #1576

Open
draarivpatel-ui wants to merge 1 commit into
postcss:mainfrom
draarivpatel-ui:fix-outdated-prefixed-values
Open

draarivpatel-ui wants to merge 1 commit into
postcss:mainfrom
draarivpatel-ui:fix-outdated-prefixed-values

Conversation

@draarivpatel-ui

Copy link
Copy Markdown

Description

When autoprefixer removes outdated prefixes, a prefixed value declaration was only dropped when a later declaration in the same rule repeated the unprefixed form of that same value. From the issue:

.example {
    display: -webkit-box;
    display: -ms-flexbox;
    display: none;
}

kept both prefixed lines with an empty browserslist, because none does not repeat the unprefixed value flex, so the declarations looked like intentional vendor hacks.

A later unprefixed declaration of the same property always wins the cascade in browsers that understand it, so the outdated prefixed declaration can never apply there, regardless of which value it carries. The removal check now also treats a later unprefixed declaration of the same property as covering the prefixed one. Lone prefixed hacks that have no unprefixed declaration at all (the behavior test/cases/value-hack.css pins down) are still preserved.

Fixes #1461

Test plan

  • Two new tests in test/autoprefixer.test.js: the reproduction from the issue now cleans up to display: none, and a lone prefixed hack without an unprefixed declaration is still preserved.
  • Full suite: 291 passed, 0 failed (uvu).

When cleaning up prefixes, a prefixed value was only removed if a later
declaration in the same rule repeated the unprefixed form of the same
value. A declaration like display: -ms-flexbox followed by display: none
was kept as if it were an intentional hack.

But a later unprefixed declaration of the same property wins the cascade
in every browser that understands it, so the outdated prefixed
declaration can never apply there, no matter what value it carries. Lone
prefixed hacks without any unprefixed declaration are still preserved.

Fixes postcss#1461
Copilot AI balanced review requested due to automatic review settings November 25, 2026 19:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@ai

ai commented Nov 25, 2026

Copy link
Copy Markdown
Member

What is your use case? If it is just idea from LLM agent and without real use case, we don't need it (too risky to break something new)

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.

-ms- vendor prefixes not always removed

3 participants