]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
bind data-api events to document instead of body to allow body replacement
authorCarl Porth <badcarl@gmail.com>
Thu, 27 Sep 2012 06:11:03 +0000 (23:11 -0700)
committerCarl Porth <badcarl@gmail.com>
Thu, 27 Sep 2012 06:11:03 +0000 (23:11 -0700)
js/bootstrap-alert.js
js/bootstrap-button.js
js/bootstrap-carousel.js
js/bootstrap-collapse.js
js/bootstrap-dropdown.js
js/bootstrap-modal.js
js/bootstrap-tab.js
js/bootstrap-typeahead.js

index 8500bd273c32dab5d07f860a7d773ab3af424e2d..ea3209ed1985d2902ffa92be0647d77d71d87d4e 100644 (file)
@@ -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);
\ No newline at end of file
index cc2d0048fdb2dab25ff036cd887bad0d0e629d7b..4c0b725c7ac072aedd1ee6381d366b273658371b 100644 (file)
@@ -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')
index 0d7167e1c23f7d3001f3940945a81b847077b536..8751b320cc88a5a2d69233ff1670a111211e6a79 100644 (file)
   * ================= */
 
   $(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())
index 7345758000c03f3547c4d4b5df501ca67533d4e6..781e274374bf87d1bdd1e4bc6bce05b49351f432 100644 (file)
   * ==================== */
 
   $(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()
index 0ef9b0f9d2be638b1496a394d0c11dd5012f4302..5a2766fdea3a700f04489b2fe25c5f7254fad908 100644 (file)
   $(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)
index d53f13a00c8b924271f8a0d5a9d7c7300cbdd9b9..8a40c2d4e6ad97149068d736b292f78c84a5dcc2 100644 (file)
   * ============== */
 
   $(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
index 4fb3c383995dc25cff79c5539bbed782c81834a3..14387a1bf424c415ed8c1b71ef2ff848b7afffd0 100644 (file)
   * ============ */
 
   $(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')
     })
index 78cbe9faa50abfdde05a04d8976a28b128045234..ab1d66879d315a0e98f4b2084c15ee191c1cfccc 100644 (file)
   * ================== */
 
   $(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()