mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-06 13:46:42 +02:00
fixes #9111
This commit is contained in:
3
dist/js/bootstrap.js
vendored
3
dist/js/bootstrap.js
vendored
@@ -925,6 +925,7 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") }
|
|||||||
this.$element
|
this.$element
|
||||||
.removeClass('in')
|
.removeClass('in')
|
||||||
.attr('aria-hidden', true)
|
.attr('aria-hidden', true)
|
||||||
|
.off('click.dismiss.modal')
|
||||||
|
|
||||||
$.support.transition && this.$element.hasClass('fade') ?
|
$.support.transition && this.$element.hasClass('fade') ?
|
||||||
this.$element
|
this.$element
|
||||||
@@ -977,7 +978,7 @@ if (!jQuery) { throw new Error("Bootstrap requires jQuery") }
|
|||||||
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
|
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
|
||||||
.appendTo(document.body)
|
.appendTo(document.body)
|
||||||
|
|
||||||
this.$element.on('click', $.proxy(function (e) {
|
this.$element.on('click.dismiss.modal', $.proxy(function (e) {
|
||||||
if (e.target !== e.currentTarget) return
|
if (e.target !== e.currentTarget) return
|
||||||
this.options.backdrop == 'static'
|
this.options.backdrop == 'static'
|
||||||
? this.$element[0].focus.call(this.$element[0])
|
? this.$element[0].focus.call(this.$element[0])
|
||||||
|
2
dist/js/bootstrap.min.js
vendored
2
dist/js/bootstrap.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -103,6 +103,7 @@
|
|||||||
this.$element
|
this.$element
|
||||||
.removeClass('in')
|
.removeClass('in')
|
||||||
.attr('aria-hidden', true)
|
.attr('aria-hidden', true)
|
||||||
|
.off('click.dismiss.modal')
|
||||||
|
|
||||||
$.support.transition && this.$element.hasClass('fade') ?
|
$.support.transition && this.$element.hasClass('fade') ?
|
||||||
this.$element
|
this.$element
|
||||||
@@ -155,7 +156,7 @@
|
|||||||
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
|
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
|
||||||
.appendTo(document.body)
|
.appendTo(document.body)
|
||||||
|
|
||||||
this.$element.on('click', $.proxy(function (e) {
|
this.$element.on('click.dismiss.modal', $.proxy(function (e) {
|
||||||
if (e.target !== e.currentTarget) return
|
if (e.target !== e.currentTarget) return
|
||||||
this.options.backdrop == 'static'
|
this.options.backdrop == 'static'
|
||||||
? this.$element[0].focus.call(this.$element[0])
|
? this.$element[0].focus.call(this.$element[0])
|
||||||
|
@@ -153,4 +153,25 @@ $(function () {
|
|||||||
})
|
})
|
||||||
.modal("show")
|
.modal("show")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test("should trigger hide event once when clicking outside of modal-content", function () {
|
||||||
|
stop()
|
||||||
|
$.support.transition = false
|
||||||
|
var div = $("<div id='modal-test'><div class='contents'></div></div>")
|
||||||
|
var triggered
|
||||||
|
div
|
||||||
|
.bind("shown.bs.modal", function () {
|
||||||
|
triggered = 0
|
||||||
|
$('#modal-test').click()
|
||||||
|
})
|
||||||
|
.one("hidden.bs.modal", function() {
|
||||||
|
div.modal("show")
|
||||||
|
})
|
||||||
|
.bind("hide.bs.modal", function () {
|
||||||
|
triggered += 1
|
||||||
|
ok(triggered === 1, 'modal hide triggered once')
|
||||||
|
start()
|
||||||
|
})
|
||||||
|
.modal("show")
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user