twitter/bootstrap — pull request #3616 by kmiyashiro (2012-05-27 21:31:32+00:00)
Title: Prevent collapse from getting stuck in transition state by calling show/hide when already shown/hidden

If you call `collapse('hide')` on a collapsable element that is already hidden, the `transitioned` event will never fire and therefore the `complete` callback will never run. That means the element's `transitioning` property will always equal `1` and it will be unresponsive to future `collapse()` calls.

This pull request adds a check for the `in` class to determine whether or not to show/hide an already shown/hidden element. This is potentially a breaking change if people rely on "shown" events for elements that are already shown... but this would be more consistent with the tab behavior where you can't show an already shown tab. Would be nice if we can add the state to the data so we don't have to check on the class.