mirror of
https://github.com/twbs/bootstrap.git
synced 2025-02-24 12:40:58 +00:00
fix #7660
This commit is contained in:
parent
6387d8d5cc
commit
57768d7ea9
11
js/modal.js
11
js/modal.js
@ -160,11 +160,12 @@
|
|||||||
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
|
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
|
||||||
.appendTo(document.body)
|
.appendTo(document.body)
|
||||||
|
|
||||||
this.$backdrop.click(
|
this.$element.on('click', $.proxy(function (e) {
|
||||||
this.options.backdrop == 'static' ?
|
if (e.target !== e.currentTarget) return
|
||||||
$.proxy(this.$element[0].focus, this.$element[0])
|
this.options.backdrop == 'static'
|
||||||
: $.proxy(this.hide, this)
|
? this.$element[0].focus.call(this.$element[0])
|
||||||
)
|
: this.hide.call(this)
|
||||||
|
}, this))
|
||||||
|
|
||||||
if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
|
if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
|
||||||
|
|
||||||
|
@ -134,4 +134,23 @@ $(function () {
|
|||||||
})
|
})
|
||||||
.modal("show")
|
.modal("show")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test("should close modal when clicking outside of modal-content", function () {
|
||||||
|
stop()
|
||||||
|
$.support.transition = false
|
||||||
|
var div = $("<div id='modal-test'><div class='contents'></div></div>")
|
||||||
|
div
|
||||||
|
.bind("shown.bs.modal", function () {
|
||||||
|
ok($('#modal-test').length, 'modal insterted into dom')
|
||||||
|
$('.contents').click()
|
||||||
|
ok($('#modal-test').is(":visible"), 'modal visible')
|
||||||
|
$('#modal-test').click()
|
||||||
|
})
|
||||||
|
.bind("hidden.bs.modal", function() {
|
||||||
|
ok(!$('#modal-test').is(":visible"), 'modal hidden')
|
||||||
|
div.remove()
|
||||||
|
start()
|
||||||
|
})
|
||||||
|
.modal("show")
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user