"collapsed" class is not added correctly to accordion toggles
This issue can be viewed on the official documentation page for Collapse at http://twitter.github.com/bootstrap/javascript.html#collapse
When I click on an accordian-toggle to expand its body, the "collapsed" class should be applied to all other accordian-toggles within the same accordion, as they will now become collapsed.
Currently, Bootstrap only applies the "collapsed" class to an accordion-toggle element when that element is explicitly clicked on to collapse its expanded body.
if you need this immediately, check out my fork with this quickfix: https://github.com/tiefenb/bootstrap/commit/a58cccd6545c76fccfd7c47ddb0d506b5e99ba4d
Fix by @tiefenb works great.
The fix by @tiefenb worked well, but one of my cases had accordions nested in accordions, sort of like what's shown here:
http://jsfiddle.net/A7fQp/
The quickfix caused the accordions nested within the expanded accordion to have their "collapsed" class removed, too, even though they were not yet opened. This is because every single ".accordion-toggle" under the one clicked is found by the "find". The very first one is the only one, I think, that should have "collapsed" removed or added (it's the upper-most of all results from the "find" method, based on what I've seen on Firefox, Safari, and Chrome). I have an update on the fix by @tiefenb below, which appears to remedy that scenario I described:
https://github.com/althaitran/bootstrap/commit/99411c15622188f24fb6714752bd5574874996c2
Oh yeah, I'm a bit new here, so I couldn't really figure out how to commit to the 2.3.0-durchblicker branch, @tiefenb, or if I'm even allowed to. I have referenced that much of the code on my patch is based on yours, though, but let me know if you don't feel comfortable with me having it there, or if I could just append to your fix on that durchblicker branch.
it is added how it was intended
sorry, i can't see the commit, where the fix happend... :-(
Basically, instead of this:
$(item.parentNode).find('.accordion-toggle').addClass('collapsed')
I used this in my commit for js/bootstrap-collapse.js (lines 86 and 72):
$(item.parentNode).find('.accordion-toggle').first().addClass('collapsed')
Similar thing applies to removeClass.