Skip to content

Commit 7f3b94c

Browse files
committed
Merge branch 'delegate-api-to-document' of git://github.com/badcarl/bootstrap into badcarl-delegate-api-to-document
Conflicts: js/bootstrap-carousel.js
2 parents 280d4ae + e1f6458 commit 7f3b94c

18 files changed

+134
-185
lines changed

docs/assets/js/bootstrap-alert.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,6 @@
8383
/* ALERT DATA-API
8484
* ============== */
8585

86-
$(function () {
87-
$('body').on('click.alert.data-api', dismiss, Alert.prototype.close)
88-
})
86+
$(document).on('click.alert.data-api', dismiss, Alert.prototype.close)
8987

9088
}(window.jQuery);

docs/assets/js/bootstrap-button.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,10 @@
8585
/* BUTTON DATA-API
8686
* =============== */
8787

88-
$(function () {
89-
$('body').on('click.button.data-api', '[data-toggle^=button]', function ( e ) {
90-
var $btn = $(e.target)
91-
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
92-
$btn.button('toggle')
93-
})
88+
$(document).on('click.button.data-api', '[data-toggle^=button]', function (e) {
89+
var $btn = $(e.target)
90+
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
91+
$btn.button('toggle')
9492
})
9593

9694
}(window.jQuery);

docs/assets/js/bootstrap-carousel.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -165,14 +165,12 @@
165165
/* CAROUSEL DATA-API
166166
* ================= */
167167

168-
$(function () {
169-
$('body').on('click.carousel.data-api', '[data-slide]', function ( e ) {
170-
var $this = $(this), href
171-
, $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
172-
, options = !$target.data('carousel') && $.extend({}, $target.data(), $this.data())
173-
$target.carousel(options)
174-
e.preventDefault()
175-
})
168+
$(document).on('click.carousel.data-api', '[data-slide]', function (e) {
169+
var $this = $(this), href
170+
, $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
171+
, options = !$target.data('carousel') && $.extend({}, $target.data(), $this.data())
172+
$target.carousel(options)
173+
e.preventDefault()
176174
})
177175

178176
}(window.jQuery);

docs/assets/js/bootstrap-collapse.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -143,16 +143,14 @@
143143
/* COLLAPSIBLE DATA-API
144144
* ==================== */
145145

146-
$(function () {
147-
$('body').on('click.collapse.data-api', '[data-toggle=collapse]', function (e) {
148-
var $this = $(this), href
149-
, target = $this.attr('data-target')
150-
|| e.preventDefault()
151-
|| (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
152-
, option = $(target).data('collapse') ? 'toggle' : $this.data()
153-
$this[$(target).hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
154-
$(target).collapse(option)
155-
})
146+
$(document).on('click.collapse.data-api', '[data-toggle=collapse]', function (e) {
147+
var $this = $(this), href
148+
, target = $this.attr('data-target')
149+
|| e.preventDefault()
150+
|| (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
151+
, option = $(target).data('collapse') ? 'toggle' : $this.data()
152+
$this[$(target).hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
153+
$(target).collapse(option)
156154
})
157155

158156
}(window.jQuery);

docs/assets/js/bootstrap-dropdown.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,10 @@
138138
/* APPLY TO STANDARD DROPDOWN ELEMENTS
139139
* =================================== */
140140

141-
$(function () {
142-
$('html')
143-
.on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus)
144-
$('body')
145-
.on('click.dropdown touchstart.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
146-
.on('click.dropdown.data-api touchstart.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
147-
.on('keydown.dropdown.data-api touchstart.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
148-
})
141+
$(document)
142+
.on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus)
143+
.on('click.dropdown touchstart.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
144+
.on('click.dropdown.data-api touchstart.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
145+
.on('keydown.dropdown.data-api touchstart.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
149146

150147
}(window.jQuery);

docs/assets/js/bootstrap-modal.js

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -214,21 +214,19 @@
214214
/* MODAL DATA-API
215215
* ============== */
216216

217-
$(function () {
218-
$('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
219-
var $this = $(this)
220-
, href = $this.attr('href')
221-
, $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
222-
, option = $target.data('modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
223-
224-
e.preventDefault()
225-
226-
$target
227-
.modal(option)
228-
.one('hide', function () {
229-
$this.focus()
230-
})
231-
})
217+
$(document).on('click.modal.data-api', '[data-toggle="modal"]', function (e) {
218+
var $this = $(this)
219+
, href = $this.attr('href')
220+
, $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
221+
, option = $target.data('modal') ? 'toggle' : $.extend({ remote:!/#/.test(href) && href }, $target.data(), $this.data())
222+
223+
e.preventDefault()
224+
225+
$target
226+
.modal(option)
227+
.one('hide', function () {
228+
$this.focus()
229+
})
232230
})
233231

234232
}(window.jQuery);

docs/assets/js/bootstrap-tab.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,9 @@
125125
/* TAB DATA-API
126126
* ============ */
127127

128-
$(function () {
129-
$('body').on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
130-
e.preventDefault()
131-
$(this).tab('show')
132-
})
128+
$(document).on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
129+
e.preventDefault()
130+
$(this).tab('show')
133131
})
134132

135133
}(window.jQuery);

docs/assets/js/bootstrap-typeahead.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -297,13 +297,11 @@
297297
/* TYPEAHEAD DATA-API
298298
* ================== */
299299

300-
$(function () {
301-
$('body').on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) {
302-
var $this = $(this)
303-
if ($this.data('typeahead')) return
304-
e.preventDefault()
305-
$this.typeahead($this.data())
306-
})
300+
$(document).on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) {
301+
var $this = $(this)
302+
if ($this.data('typeahead')) return
303+
e.preventDefault()
304+
$this.typeahead($this.data())
307305
})
308306

309307
}(window.jQuery);

docs/assets/js/bootstrap.js

Lines changed: 43 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,7 @@
142142
/* ALERT DATA-API
143143
* ============== */
144144

145-
$(function () {
146-
$('body').on('click.alert.data-api', dismiss, Alert.prototype.close)
147-
})
145+
$(document).on('click.alert.data-api', dismiss, Alert.prototype.close)
148146

149147
}(window.jQuery);/* ============================================================
150148
* bootstrap-button.js v2.1.2
@@ -233,12 +231,10 @@
233231
/* BUTTON DATA-API
234232
* =============== */
235233

236-
$(function () {
237-
$('body').on('click.button.data-api', '[data-toggle^=button]', function ( e ) {
238-
var $btn = $(e.target)
239-
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
240-
$btn.button('toggle')
241-
})
234+
$(document).on('click.button.data-api', '[data-toggle^=button]', function (e) {
235+
var $btn = $(e.target)
236+
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
237+
$btn.button('toggle')
242238
})
243239

244240
}(window.jQuery);/* ==========================================================
@@ -408,14 +404,12 @@
408404
/* CAROUSEL DATA-API
409405
* ================= */
410406

411-
$(function () {
412-
$('body').on('click.carousel.data-api', '[data-slide]', function ( e ) {
413-
var $this = $(this), href
414-
, $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
415-
, options = !$target.data('carousel') && $.extend({}, $target.data(), $this.data())
416-
$target.carousel(options)
417-
e.preventDefault()
418-
})
407+
$(document).on('click.carousel.data-api', '[data-slide]', function (e) {
408+
var $this = $(this), href
409+
, $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
410+
, options = !$target.data('carousel') && $.extend({}, $target.data(), $this.data())
411+
$target.carousel(options)
412+
e.preventDefault()
419413
})
420414

421415
}(window.jQuery);/* =============================================================
@@ -563,16 +557,14 @@
563557
/* COLLAPSIBLE DATA-API
564558
* ==================== */
565559

566-
$(function () {
567-
$('body').on('click.collapse.data-api', '[data-toggle=collapse]', function (e) {
568-
var $this = $(this), href
569-
, target = $this.attr('data-target')
570-
|| e.preventDefault()
571-
|| (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
572-
, option = $(target).data('collapse') ? 'toggle' : $this.data()
573-
$this[$(target).hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
574-
$(target).collapse(option)
575-
})
560+
$(document).on('click.collapse.data-api', '[data-toggle=collapse]', function (e) {
561+
var $this = $(this), href
562+
, target = $this.attr('data-target')
563+
|| e.preventDefault()
564+
|| (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
565+
, option = $(target).data('collapse') ? 'toggle' : $this.data()
566+
$this[$(target).hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
567+
$(target).collapse(option)
576568
})
577569

578570
}(window.jQuery);/* ============================================================
@@ -715,14 +707,11 @@
715707
/* APPLY TO STANDARD DROPDOWN ELEMENTS
716708
* =================================== */
717709

718-
$(function () {
719-
$('html')
720-
.on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus)
721-
$('body')
722-
.on('click.dropdown touchstart.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
723-
.on('click.dropdown.data-api touchstart.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
724-
.on('keydown.dropdown.data-api touchstart.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
725-
})
710+
$(document)
711+
.on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus)
712+
.on('click.dropdown touchstart.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
713+
.on('click.dropdown.data-api touchstart.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
714+
.on('keydown.dropdown.data-api touchstart.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
726715

727716
}(window.jQuery);/* =========================================================
728717
* bootstrap-modal.js v2.1.2
@@ -940,21 +929,19 @@
940929
/* MODAL DATA-API
941930
* ============== */
942931

943-
$(function () {
944-
$('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
945-
var $this = $(this)
946-
, href = $this.attr('href')
947-
, $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
948-
, option = $target.data('modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
932+
$(document).on('click.modal.data-api', '[data-toggle="modal"]', function (e) {
933+
var $this = $(this)
934+
, href = $this.attr('href')
935+
, $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
936+
, option = $target.data('modal') ? 'toggle' : $.extend({ remote:!/#/.test(href) && href }, $target.data(), $this.data())
949937

950-
e.preventDefault()
938+
e.preventDefault()
951939

952-
$target
953-
.modal(option)
954-
.one('hide', function () {
955-
$this.focus()
956-
})
957-
})
940+
$target
941+
.modal(option)
942+
.one('hide', function () {
943+
$this.focus()
944+
})
958945
})
959946

960947
}(window.jQuery);
@@ -1612,11 +1599,9 @@
16121599
/* TAB DATA-API
16131600
* ============ */
16141601

1615-
$(function () {
1616-
$('body').on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
1617-
e.preventDefault()
1618-
$(this).tab('show')
1619-
})
1602+
$(document).on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
1603+
e.preventDefault()
1604+
$(this).tab('show')
16201605
})
16211606

16221607
}(window.jQuery);/* =============================================================
@@ -1918,13 +1903,11 @@
19181903
/* TYPEAHEAD DATA-API
19191904
* ================== */
19201905

1921-
$(function () {
1922-
$('body').on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) {
1923-
var $this = $(this)
1924-
if ($this.data('typeahead')) return
1925-
e.preventDefault()
1926-
$this.typeahead($this.data())
1927-
})
1906+
$(document).on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) {
1907+
var $this = $(this)
1908+
if ($this.data('typeahead')) return
1909+
e.preventDefault()
1910+
$this.typeahead($this.data())
19281911
})
19291912

19301913
}(window.jQuery);

docs/assets/js/bootstrap.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/bootstrap-alert.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,6 @@
8383
/* ALERT DATA-API
8484
* ============== */
8585

86-
$(function () {
87-
$('body').on('click.alert.data-api', dismiss, Alert.prototype.close)
88-
})
86+
$(document).on('click.alert.data-api', dismiss, Alert.prototype.close)
8987

9088
}(window.jQuery);

js/bootstrap-button.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,10 @@
8585
/* BUTTON DATA-API
8686
* =============== */
8787

88-
$(function () {
89-
$('body').on('click.button.data-api', '[data-toggle^=button]', function ( e ) {
90-
var $btn = $(e.target)
91-
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
92-
$btn.button('toggle')
93-
})
88+
$(document).on('click.button.data-api', '[data-toggle^=button]', function (e) {
89+
var $btn = $(e.target)
90+
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
91+
$btn.button('toggle')
9492
})
9593

9694
}(window.jQuery);

js/bootstrap-carousel.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -165,14 +165,12 @@
165165
/* CAROUSEL DATA-API
166166
* ================= */
167167

168-
$(function () {
169-
$('body').on('click.carousel.data-api', '[data-slide]', function ( e ) {
170-
var $this = $(this), href
171-
, $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
172-
, options = !$target.data('carousel') && $.extend({}, $target.data(), $this.data())
173-
$target.carousel(options)
174-
e.preventDefault()
175-
})
168+
$(document).on('click.carousel.data-api', '[data-slide]', function (e) {
169+
var $this = $(this), href
170+
, $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
171+
, options = !$target.data('carousel') && $.extend({}, $target.data(), $this.data())
172+
$target.carousel(options)
173+
e.preventDefault()
176174
})
177175

178176
}(window.jQuery);

0 commit comments

Comments
 (0)