Hacker News new | ask | show | jobs
by dotborg 4872 days ago
Replace all CSS transitions with JavaScript transitions.

why?

3 comments

I'll probably write up something at length about this decision when/if it happens… but this is the current thinking:

CSS transitions are just total shit to deal with in javascript.

What people often don't realize is that there is an event for transitionEnd in javascript – but this isn't always fired in a reliable way – only when a transition successfully ends (which isn't all the time).

This is incredibly problematic because often really important functionality is tied to the completion of transitions.

Because these functions never finish, sometimes you're left with dead dom nodes or weird incomplete states.

What's more, there isn't a performance benefit to using css transitions – the benefit is that they were suppose to be make transitions easier and provide a nice separation of style from logic – but they end up being incredibly more difficult and because of the necessary fallback logic, the styles end up leaking back into your logic anyways. It's a pain in the neck :/

With bootstrap we really just want to give everyone the most reliable product we can, and css transitions just aren't that.

Also, from what I hear, the spec is basically dead in the water – and a reliable cancel event isn't in the works (unless this has changed in the last month or so)… which is more of a reason to consider alternatives.

Most likely we will end up going with some sort of combination. CSS transitions when we don't need a reliable "complete" event – and css transitions when we don't really care (though this case is becoming more infrequent).

Thanks for taking the time to explain this fat, I had noticed problems with transitionEnd sometimes not firing but never got around to researching it.
It's on our list to check it out because of some of lack of control CSS transitions afford us. Hacks with overflow hidden cause issues, mobile performance is rather spotty, and more. Not a guarantee, but we're considering it.
An inadvisable goal of supporting ludicrously obsolete browsers?