Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guarantee invokation of complete() #5598

Closed
wants to merge 2 commits into from

Conversation

victor-homyakov
Copy link

Transition end event isn't reliable (browser may not fire it, or delay its firing until next transition, in many circumstances, read more in related issue #5462 #5462).

In order to guarantee proper inner state of Collapse object (especially Collapse#transitioning, because its invalid state will block all successive transitions) additional callback invokation is added with setTimeout().

Timeout value for setTimeout() should be equal to transition time from component-animation.less - I cannot find a better solution for now.

Transition end event isn't reliable (browser may not fire it, or delay its firing until next transition, in many circumstances, read more in related issue twbs#5462 twbs#5462).

In order to guarantee proper inner state of `Collapse` object (especially `Collapse#transitioning`, because its invalid state will block all successive transitions) additional callback invokation is added with `setTimeout()`.

Timeout value for `setTimeout()` is equal to transition time from `component-animation.less` - I cannot find a better solution for now.
@ghost
Copy link

ghost commented Nov 20, 2012

Your patch causes unexpected behavior when setTimeout executes the complete function. It relies on the startEvent parameter of the calling transition function, which seems to be unreliable at times, especially when clicking on the collapse toggle several times in a row. The problem lies in the complete function thinking that the startEvent.type is 'show' when it's actually 'hide' since the complete function is called a few times.

To fix this problem, simply pass in the original startEvent as a parameter to the complete function.

Here's the gist: https://gist.github.com/4121673

I'm also passing in the Collapse context, which I use instead of the 'that' variable.

@fat
Copy link
Member

fat commented Dec 20, 2012

honestly - i want to rip all css transitions out of bootstrap (maybe for 3.0.0). they are a complete mess of a spec, and just a piece of shit in general. which is sad. :( but not a good thing to build a solid product on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants