mirror of https://github.com/twbs/bootstrap.git
bind data-api events to document instead of body to allow body replacement
This commit is contained in:
parent
24e277b85a
commit
474471b831
|
|
@ -84,7 +84,7 @@
|
||||||
* ============== */
|
* ============== */
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
$('body').on('click.alert.data-api', dismiss, Alert.prototype.close)
|
$(document).on('click.alert.data-api', dismiss, Alert.prototype.close)
|
||||||
})
|
})
|
||||||
|
|
||||||
}(window.jQuery);
|
}(window.jQuery);
|
||||||
|
|
@ -86,7 +86,7 @@
|
||||||
* =============== */
|
* =============== */
|
||||||
|
|
||||||
$(function () {
|
$(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)
|
var $btn = $(e.target)
|
||||||
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
|
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
|
||||||
$btn.button('toggle')
|
$btn.button('toggle')
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,7 @@
|
||||||
* ================= */
|
* ================= */
|
||||||
|
|
||||||
$(function () {
|
$(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
|
var $this = $(this), href
|
||||||
, $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
|
, $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
|
||||||
, options = !$target.data('modal') && $.extend({}, $target.data(), $this.data())
|
, options = !$target.data('modal') && $.extend({}, $target.data(), $this.data())
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@
|
||||||
* ==================== */
|
* ==================== */
|
||||||
|
|
||||||
$(function () {
|
$(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
|
var $this = $(this), href
|
||||||
, target = $this.attr('data-target')
|
, target = $this.attr('data-target')
|
||||||
|| e.preventDefault()
|
|| e.preventDefault()
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,7 @@
|
||||||
$(function () {
|
$(function () {
|
||||||
$('html')
|
$('html')
|
||||||
.on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus)
|
.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 touchstart.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
|
||||||
.on('click.dropdown.data-api touchstart.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
|
.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)
|
.on('keydown.dropdown.data-api touchstart.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
|
||||||
|
|
|
||||||
|
|
@ -216,7 +216,7 @@
|
||||||
* ============== */
|
* ============== */
|
||||||
|
|
||||||
$(function () {
|
$(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)
|
var $this = $(this)
|
||||||
, href = $this.attr('href')
|
, href = $this.attr('href')
|
||||||
, $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
|
, $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@
|
||||||
* ============ */
|
* ============ */
|
||||||
|
|
||||||
$(function () {
|
$(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()
|
e.preventDefault()
|
||||||
$(this).tab('show')
|
$(this).tab('show')
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -298,7 +298,7 @@
|
||||||
* ================== */
|
* ================== */
|
||||||
|
|
||||||
$(function () {
|
$(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)
|
var $this = $(this)
|
||||||
if ($this.data('typeahead')) return
|
if ($this.data('typeahead')) return
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue