postcss / autoprefixer

Parse CSS and add vendor prefixes to rules by Can I Use
https://twitter.com/autoprefixer
MIT License
21.58k stars 1.25k forks source link

Autoprefixer writes new styles for each prefixed property instead of grouping them #1451

Closed citedev closed 2 years ago

citedev commented 2 years ago

When I write:

input::placeholder, textarea::placeholder {
    font-size: 14px;
    opacity: 0.7;

I expect to see something like that:

input::-webkit-input-placeholder, textarea::-webkit-input-placeholder,
input::-moz-placeholder, textarea::-moz-placeholder,
input:-ms-input-placeholder, textarea:-ms-input-placeholder,
input::-ms-input-placeholder, textarea::-ms-input-placeholder,
input::placeholder, textarea::placeholder {
    font-size: 14px;
    opacity: 0.7;

But it does that:

input::-webkit-input-placeholder, textarea::-webkit-input-placeholder {
    font-size: 14px;
    opacity: 0.7;
}

input::-moz-placeholder, textarea::-moz-placeholder {
    font-size: 14px;
    opacity: 0.7;
}

input:-ms-input-placeholder, textarea:-ms-input-placeholder {
    font-size: 14px;
    opacity: 0.7;
}

input::-ms-input-placeholder, textarea::-ms-input-placeholder {
    font-size: 14px;
    opacity: 0.7;
}

input::placeholder, textarea::placeholder {
    font-size: 14px;
    opacity: 0.7;

Any way to fix ?

ai commented 2 years ago

Autoprefixer does it for reason.

Browser will ignore the whole group of any selector is invalid (for instance, because of vendor prefix).

citedev commented 2 years ago

Autoprefixer does it for reason.

Browser will ignore the whole group of any selector is invalid (for instance, because of vendor prefix).

Thanks for the lightning-fast response, good explanation.