question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem with vendor prefix inserted *after* standard syntax

See original GitHub issue

Good morning,

I’m using autoprefixer 6.6.1 and I noticed a problem with the order of a CSS selector it produces.

In my Sass file, if I write:

.some-selector {
  transition: color .15s, transform .5s;
}

Autoprefixer generates the following code:

.some-selector {
  -webkit-transition: color .15s, -webkit-transform .5s;
  transition: color .15s, -webkit-transform .5s;
  transition: color .15s, transform .5s;
  transition: color .15s, transform .5s, -webkit-transform .5s;
}

The last line (transition: color .15s, transform .5s, -webkit-transform .5s;) contains a vendor prefix but since it comes last, it has priority over the previous line (transition: color .15s, transform .5s;) which contains no vendor prefix.

As a result, the transition does not work on Chrome 55.0.2883.95 (64-bit) nor on Firefox 50.1.0.

How would it be possible to invert both lines please? I’m stuck. Thanks for your help!

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
aicommented, Jan 9, 2017

I found problem. transition-delay is hard coded to 2 values only, so it stop working on 3 values in transition: color .15s, transform .5s, -webkit-transform .5s.

transition-delay: 0s, #{50 + (50 * $i)}ms;

You can fix it by:

transition-delay: 0s, #{50 + (50 * $i)}ms, #{50 + (50 * $i)}ms;

Unfortunately, there is no way to prefix it in other way. Browsers that you support requires -webkit-transform. And the only way to fix it is this big preset and different values length (we thought a lot about some other solution).

Technically, Autoprefixer even warn you about this risk. But you should use gulp/webpack Aurtoprefixer to see warnings. Maybe we need ask @chriscoyier to add some UI and show warnings from PostCSS plugins.

0reactions
kReEsTaLcommented, Jan 9, 2017

Great, thank you so much for your help @ai!

I still cannot figure why I cannot compile the line you suggested:

transition-delay: 0s, #{50 + (50 * $i)}ms, #{50 + (50 * $i)}ms;

Anyway, if I ditch the Sass for loop and write it by hand, it works. Another mystery yet to solve!

By the way, menu animation is really gorgeous 👍

All credits go to @Twikito! 😃 As for the BEM syntax, yes you’re absolutely right. However the original CodePen is a quick demo he wrote, so that may be the reason why the code is not as compact as it could be.

Thank you again so much for your help! \m/

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Deal With Vendor Prefixes - CSS-Tricks
There are plenty of different ways to deal with vendor prefixes in CSS as part of your workflow. It depends on if you...
Read more >
CSS vendor prefixes considered harmful - QuirksBlog
It's time to abolish all vendor prefixes. They've become solutions for which there is no problem, and they are actively harming web standards....
Read more >
Why use specific vendor prefixes instead of one representing ...
The problem with WebKit prefixes simply stems from a widespread abuse of prefixes by both vendors and authors (mostly with authors choosing to...
Read more >
Vendor Prefixes Are Hurting the Web - Henri Sivonen
TL;DR: I think vendor prefixes are hurting the Web. They are hurting Web authors. They are hurting users of browsers. They are hurting ......
Read more >
Vendor prefixes are not developer-friendly - Paul Irish
While plenty of implementation bugs were fixed, the developer would never have updated their syntax and would have complete browser support. box ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found