From d8d6e400977e80fd50358b821bc643a2a73ca97e Mon Sep 17 00:00:00 2001
From: Jacob Thornton <jacobthornton@gmail.com>
Date: Sun, 28 Aug 2011 17:32:31 -0700
Subject: [PATCH] listen to delegation for ie

---
 examples/assets/js/bootstrap-modal.js | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/examples/assets/js/bootstrap-modal.js b/examples/assets/js/bootstrap-modal.js
index 858e63c56d..c4d9170970 100644
--- a/examples/assets/js/bootstrap-modal.js
+++ b/examples/assets/js/bootstrap-modal.js
@@ -107,10 +107,13 @@
         , animate = this.$element.hasClass('fade') ? 'fade' : ''
       if ( this.isOpen && this.settings.backdrop ) {
         this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
-          .click(function () { that.close() })
           .appendTo(document.body)
+        $('body').delegate('.modal-backdrop', 'click.modal.backdrop', function () {
+          that.close()
+        })
       } else if ( !this.isOpen && this.$backdrop ) {
         this.$backdrop.removeClass('in')
+        $('body').undelegate('click.modal.backdrop')
 
         function removeElement() {
           that.$backdrop.remove()
@@ -126,13 +129,13 @@
   , escape: function () {
       var that = this
       if ( this.isOpen && this.settings.closeOnEscape ) {
-        $(window).bind('keyup.modal.escape', function ( e ) {
+        $('body').bind('keyup.modal.escape', function ( e ) {
           if ( e.which == 27 ) {
             that.close()
           }
         })
       } else if ( !this.isOpen ) {
-        $(window).unbind('keyup.modal.escape')
+        $('body').unbind('keyup.modal.escape')
       }
     }
 
-- 
GitLab