]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
don't wait for ready when binding events to document 5308/head
authorCarl Porth <badcarl@gmail.com>
Thu, 27 Sep 2012 22:00:02 +0000 (15:00 -0700)
committerCarl Porth <badcarl@gmail.com>
Thu, 27 Sep 2012 22:00:02 +0000 (15:00 -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 ea3209ed1985d2902ffa92be0647d77d71d87d4e..b0bdc4b7d91a7da4c63b06f93a2d60a2926f5ffd 100644 (file)
@@ -83,8 +83,6 @@
  /* ALERT DATA-API
   * ============== */
 
-  $(function () {
-    $(document).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 4c0b725c7ac072aedd1ee6381d366b273658371b..dbb2c08ed33bbaf8f6a1a8e9b2002e094c250735 100644 (file)
  /* BUTTON DATA-API
   * =============== */
 
-  $(function () {
-    $(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')
-    })
+  $(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')
   })
 
 }(window.jQuery);
\ No newline at end of file
index 8751b320cc88a5a2d69233ff1670a111211e6a79..6b01f763b4d5feae5e831318ee3ea3564c1861d4 100644 (file)
  /* CAROUSEL DATA-API
   * ================= */
 
-  $(function () {
-    $(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())
-      $target.carousel(options)
-      e.preventDefault()
-    })
+  $(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())
+    $target.carousel(options)
+    e.preventDefault()
   })
 
 }(window.jQuery);
\ No newline at end of file
index 781e274374bf87d1bdd1e4bc6bce05b49351f432..392e486a8984421229cdb392fb295619ae5e15e4 100644 (file)
  /* COLLAPSIBLE DATA-API
   * ==================== */
 
-  $(function () {
-    $(document).on('click.collapse.data-api', '[data-toggle=collapse]', function (e) {
-      var $this = $(this), href
-        , target = $this.attr('data-target')
-          || e.preventDefault()
-          || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
-        , option = $(target).data('collapse') ? 'toggle' : $this.data()
-      $this[$(target).hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
-      $(target).collapse(option)
-    })
+  $(document).on('click.collapse.data-api', '[data-toggle=collapse]', function (e) {
+    var $this = $(this), href
+      , target = $this.attr('data-target')
+        || e.preventDefault()
+        || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
+      , option = $(target).data('collapse') ? 'toggle' : $this.data()
+    $this[$(target).hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
+    $(target).collapse(option)
   })
 
 }(window.jQuery);
\ No newline at end of file
index 5a2766fdea3a700f04489b2fe25c5f7254fad908..f50aa64d62065e9139181c64ad382d16634bc1a9 100644 (file)
   /* APPLY TO STANDARD DROPDOWN ELEMENTS
    * =================================== */
 
-  $(function () {
-    $('html')
-      .on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus)
-    $(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)
-  })
+  $(document)
+    .on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus)
+    .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)
 
 }(window.jQuery);
\ No newline at end of file
index 8a40c2d4e6ad97149068d736b292f78c84a5dcc2..0030ad7c509ec62d55c7abe2501585d3bdcb77b3 100644 (file)
  /* MODAL DATA-API
   * ============== */
 
-  $(function () {
-    $(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
-        , option = $target.data('modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
-
-      e.preventDefault()
-
-      $target
-        .modal(option)
-        .one('hide', function () {
-          $this.focus()
-        })
-    })
+  $(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
+      , option = $target.data('modal') ? 'toggle' : $.extend({ remote:!/#/.test(href) && href }, $target.data(), $this.data())
+
+    e.preventDefault()
+
+    $target
+      .modal(option)
+      .one('hide', function () {
+        $this.focus()
+      })
   })
 
 }(window.jQuery);
\ No newline at end of file
index 14387a1bf424c415ed8c1b71ef2ff848b7afffd0..8d73cd5515f7115266a49af010de6f49bbd7b479 100644 (file)
  /* TAB DATA-API
   * ============ */
 
-  $(function () {
-    $(document).on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
-      e.preventDefault()
-      $(this).tab('show')
-    })
+  $(document).on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
+    e.preventDefault()
+    $(this).tab('show')
   })
 
 }(window.jQuery);
\ No newline at end of file
index ab1d66879d315a0e98f4b2084c15ee191c1cfccc..dc0c7fa07aecef677daa7dc1e0aa812b06354303 100644 (file)
  /*   TYPEAHEAD DATA-API
   * ================== */
 
-  $(function () {
-    $(document).on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) {
-      var $this = $(this)
-      if ($this.data('typeahead')) return
-      e.preventDefault()
-      $this.typeahead($this.data())
-    })
+  $(document).on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) {
+    var $this = $(this)
+    if ($this.data('typeahead')) return
+    e.preventDefault()
+    $this.typeahead($this.data())
   })
 
 }(window.jQuery);