twitter/bootstrap — pull request #5022 by avalla (2012-09-06 17:21:44+00:00)
Title: Multiple modals fix

If you want to use a modal on another modal (I know that is a bit strange, but I needed it), when you close the second one, it removes modal-open class from body.
If you have a typeahead here on the first one, the dropdown will go behind the modal.

So I fixed this removing the class if there are only 1 modal opened, with this check:

```javascript
if ($("div.modal.in").length <= 1)
```

The close event on second modals doesn't works the first time, the row 93 generate an error:

Uncaught RangeError: Maximum call stack size exceeded

Function called:
```javascript
this.$element.trigger(e)
```
so I added the same check there too (I don't know if this could generate any other errors)

examples:
error: http://jsfiddle.net/DtPY4/
fixed: http://jsfiddle.net/KQXqM/