mirror of
https://github.com/twbs/bootstrap.git
synced 2022-11-09 12:25:43 -05:00
bind data-api events to document instead of body to allow body replacement
This commit is contained in:
parent
24e277b85a
commit
474471b831
8 changed files with 8 additions and 8 deletions
2
js/bootstrap-alert.js
vendored
2
js/bootstrap-alert.js
vendored
|
@ -84,7 +84,7 @@
|
|||
* ============== */
|
||||
|
||||
$(function () {
|
||||
$('body').on('click.alert.data-api', dismiss, Alert.prototype.close)
|
||||
$(document).on('click.alert.data-api', dismiss, Alert.prototype.close)
|
||||
})
|
||||
|
||||
}(window.jQuery);
|
2
js/bootstrap-button.js
vendored
2
js/bootstrap-button.js
vendored
|
@ -86,7 +86,7 @@
|
|||
* =============== */
|
||||
|
||||
$(function () {
|
||||
$('body').on('click.button.data-api', '[data-toggle^=button]', function ( e ) {
|
||||
$(document).on('click.button.data-api', '[data-toggle^=button]', function ( e ) {
|
||||
var $btn = $(e.target)
|
||||
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
|
||||
$btn.button('toggle')
|
||||
|
|
2
js/bootstrap-carousel.js
vendored
2
js/bootstrap-carousel.js
vendored
|
@ -164,7 +164,7 @@
|
|||
* ================= */
|
||||
|
||||
$(function () {
|
||||
$('body').on('click.carousel.data-api', '[data-slide]', function ( e ) {
|
||||
$(document).on('click.carousel.data-api', '[data-slide]', function ( e ) {
|
||||
var $this = $(this), href
|
||||
, $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
|
||||
, options = !$target.data('modal') && $.extend({}, $target.data(), $this.data())
|
||||
|
|
2
js/bootstrap-collapse.js
vendored
2
js/bootstrap-collapse.js
vendored
|
@ -144,7 +144,7 @@
|
|||
* ==================== */
|
||||
|
||||
$(function () {
|
||||
$('body').on('click.collapse.data-api', '[data-toggle=collapse]', function (e) {
|
||||
$(document).on('click.collapse.data-api', '[data-toggle=collapse]', function (e) {
|
||||
var $this = $(this), href
|
||||
, target = $this.attr('data-target')
|
||||
|| e.preventDefault()
|
||||
|
|
2
js/bootstrap-dropdown.js
vendored
2
js/bootstrap-dropdown.js
vendored
|
@ -141,7 +141,7 @@
|
|||
$(function () {
|
||||
$('html')
|
||||
.on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus)
|
||||
$('body')
|
||||
$(document)
|
||||
.on('click.dropdown touchstart.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
|
||||
.on('click.dropdown.data-api touchstart.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
|
||||
.on('keydown.dropdown.data-api touchstart.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
|
||||
|
|
2
js/bootstrap-modal.js
vendored
2
js/bootstrap-modal.js
vendored
|
@ -216,7 +216,7 @@
|
|||
* ============== */
|
||||
|
||||
$(function () {
|
||||
$('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
|
||||
$(document).on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
|
||||
var $this = $(this)
|
||||
, href = $this.attr('href')
|
||||
, $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
|
||||
|
|
2
js/bootstrap-tab.js
vendored
2
js/bootstrap-tab.js
vendored
|
@ -126,7 +126,7 @@
|
|||
* ============ */
|
||||
|
||||
$(function () {
|
||||
$('body').on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
|
||||
$(document).on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
|
||||
e.preventDefault()
|
||||
$(this).tab('show')
|
||||
})
|
||||
|
|
2
js/bootstrap-typeahead.js
vendored
2
js/bootstrap-typeahead.js
vendored
|
@ -298,7 +298,7 @@
|
|||
* ================== */
|
||||
|
||||
$(function () {
|
||||
$('body').on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) {
|
||||
$(document).on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) {
|
||||
var $this = $(this)
|
||||
if ($this.data('typeahead')) return
|
||||
e.preventDefault()
|
||||
|
|
Loading…
Reference in a new issue