diff --git a/docs/javascript.html b/docs/javascript.html
index 79d5b2c8ea..359dc68c50 100644
--- a/docs/javascript.html
+++ b/docs/javascript.html
@@ -17,7 +17,7 @@ lead: "Bring Bootstrap's components to life with over a dozen custom jQuery plug
Plugins can be included individually, or all at once. Do not attempt to include both. Both bootstrap.js and bootstrap.min.js contain all plugins in a single file.
diff --git a/js/tests/unit/affix.js b/js/tests/unit/affix.js
index 9829b05ad9..b74bc51e48 100644
--- a/js/tests/unit/affix.js
+++ b/js/tests/unit/affix.js
@@ -18,7 +18,7 @@ $(function () {
test("should exit early if element is not visible", function () {
var $affix = $('
').affix()
- $affix.data('bs-affix').checkPosition()
+ $affix.data('bs.affix').checkPosition()
ok(!$affix.hasClass('affix'), 'affix class was not added')
})
diff --git a/js/tests/unit/alert.js b/js/tests/unit/alert.js
index 3054767f6b..98b10059e1 100644
--- a/js/tests/unit/alert.js
+++ b/js/tests/unit/alert.js
@@ -1,6 +1,6 @@
$(function () {
- module("alerts")
+ module("alert")
test("should provide no conflict", function () {
var alert = $.fn.alert.noConflict()
@@ -48,12 +48,12 @@ $(function () {
$.support.transition = false
stop();
$('
')
- .bind('bs:alert:close', function (e) {
+ .on('close.bs.alert', function (e) {
e.preventDefault();
ok(true);
start();
})
- .bind('bs:alert:closed', function () {
+ .on('closed.bs.alert', function () {
ok(false);
})
.alert('close')
diff --git a/js/tests/unit/button.js b/js/tests/unit/button.js
index aaf480c32e..943d36d1b4 100644
--- a/js/tests/unit/button.js
+++ b/js/tests/unit/button.js
@@ -1,6 +1,6 @@
$(function () {
- module("buttons")
+ module("button")
test("should provide no conflict", function () {
var button = $.fn.button.noConflict()
diff --git a/js/tests/unit/carousel.js b/js/tests/unit/carousel.js
index 4d0bd6e819..f4acda02a7 100644
--- a/js/tests/unit/carousel.js
+++ b/js/tests/unit/carousel.js
@@ -20,12 +20,12 @@ $(function () {
$.support.transition = false
stop()
$('
')
- .bind('bs:carousel:slide', function (e) {
+ .on('slide.bs.carousel', function (e) {
e.preventDefault();
ok(true);
start();
})
- .bind('bs:carousel:slid', function () {
+ .on('slid.bs.carousel', function () {
ok(false);
})
.carousel('next')
@@ -35,7 +35,7 @@ $(function () {
var template = '
{{_i}}First Thumbnail label{{/i}}
Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.
{{_i}}Second Thumbnail label{{/i}}
Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.
{{_i}}Third Thumbnail label{{/i}}
Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.
‹›'
$.support.transition = false
stop()
- $(template).on('bs:carousel:slide', function (e) {
+ $(template).on('slide.bs.carousel', function (e) {
e.preventDefault()
ok(e.direction)
ok(e.direction === 'right' || e.direction === 'left')
@@ -48,7 +48,7 @@ $(function () {
$.support.transition = false
stop()
$(template)
- .on('bs:carousel:slide', function (e) {
+ .on('slide.bs.carousel', function (e) {
e.preventDefault();
ok(e.relatedTarget);
ok($(e.relatedTarget).hasClass('item'));
@@ -63,19 +63,19 @@ $(function () {
template.appendTo("body");
$('[data-slide]').first().click();
- ok($('#myCarousel').data('bs-carousel').options.interval == 1814);
+ ok($('#myCarousel').data('bs.carousel').options.interval == 1814);
$('#myCarousel').remove();
template.appendTo("body").attr("data-modal", "foobar");
$('[data-slide]').first().click();
- ok($('#myCarousel').data('bs-carousel').options.interval == 1814, "even if there is an data-modal attribute set");
+ ok($('#myCarousel').data('bs.carousel').options.interval == 1814, "even if there is an data-modal attribute set");
$('#myCarousel').remove();
template.appendTo("body");
$('[data-slide]').first().click();
$('#myCarousel').attr('data-interval', 1860);
$('[data-slide]').first().click();
- ok($('#myCarousel').data('bs-carousel').options.interval == 1814, "attributes should be read only on intitialization");
+ ok($('#myCarousel').data('bs.carousel').options.interval == 1814, "attributes should be read only on intitialization");
$('#myCarousel').remove();
})
})
diff --git a/js/tests/unit/collapse.js b/js/tests/unit/collapse.js
index 832d6d45db..dd2cee27db 100644
--- a/js/tests/unit/collapse.js
+++ b/js/tests/unit/collapse.js
@@ -32,12 +32,12 @@ $(function () {
$.support.transition = false
stop()
$('
')
- .bind('bs:collapse:show', function (e) {
+ .on('show.bs.collapse', function (e) {
e.preventDefault();
ok(true);
start();
})
- .bind('bs:collapse:shown', function () {
+ .on('shown.bs.collapse', function () {
ok(false);
})
.collapse('show')
@@ -47,10 +47,10 @@ $(function () {
$.support.transition = false
stop()
$('
')
- .bind('bs:collapse:show', function () {
+ .on('show.bs.collapse', function () {
ok(this.style.height == '0px')
})
- .bind('bs:collapse:shown', function () {
+ .on('shown.bs.collapse', function () {
ok(this.style.height == 'auto')
start()
})
@@ -66,7 +66,7 @@ $(function () {
var collapsible = $('
')
.appendTo($('#qunit-fixture'))
- .on('bs:collapse:show', function () {
+ .on('show.bs.collapse', function () {
ok(!target.hasClass('collapsed'))
start()
})
@@ -83,7 +83,7 @@ $(function () {
var collapsible = $('
')
.appendTo($('#qunit-fixture'))
- .on('bs:collapse:hide', function () {
+ .on('hide.bs.collapse', function () {
ok(target.hasClass('collapsed'))
start()
})
diff --git a/js/tests/unit/dropdown.js b/js/tests/unit/dropdown.js
index 6b66c0974f..09b5673a46 100644
--- a/js/tests/unit/dropdown.js
+++ b/js/tests/unit/dropdown.js
@@ -103,8 +103,9 @@ $(function () {
.find('[data-toggle="dropdown"]')
.dropdown()
.click()
+
ok(dropdown.parent('.dropdown').hasClass('open'), 'open class added on click')
- $('.dropdown-backdrop').click()
+ $('body').click()
ok(!dropdown.parent('.dropdown').hasClass('open'), 'open class removed')
dropdown.remove()
})
@@ -136,13 +137,13 @@ $(function () {
first.click()
ok(first.parents('.open').length == 1, 'open class added on click')
ok($('#qunit-fixture .open').length == 1, 'only one object is open')
- $('.dropdown-backdrop').click()
+ $('body').click()
ok($("#qunit-fixture .open").length === 0, 'open class removed')
last.click()
ok(last.parent('.open').length == 1, 'open class added on click')
ok($('#qunit-fixture .open').length == 1, 'only one object is open')
- $('.dropdown-backdrop').click()
+ $('body').click()
ok($("#qunit-fixture .open").length === 0, 'open class removed')
$("#qunit-fixture").html("")
diff --git a/js/tests/unit/modal.js b/js/tests/unit/modal.js
index 7d684f3ae8..7ee47be38b 100644
--- a/js/tests/unit/modal.js
+++ b/js/tests/unit/modal.js
@@ -27,7 +27,7 @@ $(function () {
stop()
$.support.transition = false
$("
")
- .bind("bs:modal:shown", function () {
+ .on("shown.bs.modal", function () {
ok($('#modal-test').length, 'modal insterted into dom')
$(this).remove()
start()
@@ -39,10 +39,10 @@ $(function () {
stop()
$.support.transition = false
$("
")
- .bind("bs:modal:show", function () {
+ .on("show.bs.modal", function () {
ok(true, "show was called")
})
- .bind("bs:modal:shown", function () {
+ .on("shown.bs.modal", function () {
$(this).remove()
start()
})
@@ -53,12 +53,12 @@ $(function () {
stop()
$.support.transition = false
$("
")
- .bind("bs:modal:show", function (e) {
+ .on("show.bs.modal", function (e) {
e.preventDefault()
ok(true, "show was called")
start()
})
- .bind("bs:modal:shown", function () {
+ .on("shown.bs.modal", function () {
ok(false, "shown was called")
})
.modal("show")
@@ -69,12 +69,12 @@ $(function () {
$.support.transition = false
$("
")
- .bind("bs:modal:shown", function () {
+ .on("shown.bs.modal", function () {
ok($('#modal-test').is(":visible"), 'modal visible')
ok($('#modal-test').length, 'modal insterted into dom')
$(this).modal("hide")
})
- .bind("bs:modal:hidden", function() {
+ .on("hidden.bs.modal", function() {
ok(!$('#modal-test').is(":visible"), 'modal hidden')
$('#modal-test').remove()
start()
@@ -87,12 +87,12 @@ $(function () {
$.support.transition = false
var div = $("
")
div
- .bind("bs:modal:shown", function () {
+ .on("shown.bs.modal", function () {
ok($('#modal-test').is(":visible"), 'modal visible')
ok($('#modal-test').length, 'modal insterted into dom')
div.modal("toggle")
})
- .bind("bs:modal:hidden", function() {
+ .on("hidden.bs.modal", function() {
ok(!$('#modal-test').is(":visible"), 'modal hidden')
div.remove()
start()
@@ -105,12 +105,12 @@ $(function () {
$.support.transition = false
var div = $("
")
div
- .bind("bs:modal:shown", function () {
+ .on("shown.bs.modal", function () {
ok($('#modal-test').is(":visible"), 'modal visible')
ok($('#modal-test').length, 'modal insterted into dom')
div.find('.close').click()
})
- .bind("bs:modal:hidden", function() {
+ .on("hidden.bs.modal", function() {
ok(!$('#modal-test').is(":visible"), 'modal hidden')
div.remove()
start()
@@ -123,11 +123,11 @@ $(function () {
$.support.transition = false
var div = $("
", { id: 'modal-test', "data-backdrop": false })
div
- .bind("bs:modal:shown", function () {
+ .on("shown.bs.modal", function () {
ok($('#modal-test').is(":visible"), 'modal visible')
div.modal("hide")
})
- .bind("bs:modal:hidden", function() {
+ .on("hidden.bs.modal", function() {
ok(!$('#modal-test').is(":visible"), 'modal hidden')
div.remove()
start()
diff --git a/js/tests/unit/popover.js b/js/tests/unit/popover.js
index 53980e7228..fb00175673 100644
--- a/js/tests/unit/popover.js
+++ b/js/tests/unit/popover.js
@@ -34,7 +34,7 @@ $(function () {
var popover = $('
@mdo')
.popover()
- ok(!!popover.data('bs-popover'), 'popover instance exists')
+ ok(!!popover.data('bs.popover'), 'popover instance exists')
})
test("should get title and content from options", function () {
@@ -99,7 +99,7 @@ $(function () {
test("should destroy popover", function () {
var popover = $('
').popover({trigger: 'hover'}).on('click.foo', function(){})
- ok(popover.data('bs-popover'), 'popover has data')
+ ok(popover.data('bs.popover'), 'popover has data')
ok($._data(popover[0], 'events').mouseover && $._data(popover[0], 'events').mouseout, 'popover has hover event')
ok($._data(popover[0], 'events').click[0].namespace == 'foo', 'popover has extra click.foo event')
popover.popover('show')
diff --git a/js/tests/unit/tab.js b/js/tests/unit/tab.js
index 40e4656a74..aede32abb1 100644
--- a/js/tests/unit/tab.js
+++ b/js/tests/unit/tab.js
@@ -53,12 +53,12 @@ $(function () {
$.support.transition = false
stop();
$('
')
- .bind('bs:tab:show', function (e) {
+ .on('show.bs.tab', function (e) {
e.preventDefault();
ok(true);
start();
})
- .bind('bs:tab:shown', function () {
+ .on('shown.bs.tab', function () {
ok(false);
})
.tab('show')
@@ -78,7 +78,7 @@ $(function () {
$(dropHTML).find('ul>li:first a').tab('show').end()
.find('ul>li:last a').on('show', function(event){
equals(event.relatedTarget.hash, "#1-1")
- }).on('bs:tab:shown', function(event){
+ }).on('shown', function(event){
equals(event.relatedTarget.hash, "#1-1")
}).tab('show')
})
diff --git a/js/tests/unit/tooltip.js b/js/tests/unit/tooltip.js
index 8a1be0ecad..638edefc26 100644
--- a/js/tests/unit/tooltip.js
+++ b/js/tests/unit/tooltip.js
@@ -69,7 +69,7 @@ $(function () {
test("should fire show event", function () {
stop()
var tooltip = $('
')
- .bind("bs:tooltip:show", function() {
+ .on("show.bs.tooltip", function() {
ok(true, "show was called")
start()
})
@@ -79,7 +79,7 @@ $(function () {
test("should fire shown event", function () {
stop()
var tooltip = $('
')
- .bind("bs:tooltip:shown", function() {
+ .on("shown.bs.tooltip", function() {
ok(true, "shown was called")
start()
})
@@ -89,12 +89,12 @@ $(function () {
test("should not fire shown event when default prevented", function () {
stop()
var tooltip = $('
')
- .bind("bs:tooltip:show", function(e) {
+ .on("show.bs.tooltip", function(e) {
e.preventDefault()
ok(true, "show was called")
start()
})
- .bind("bs:tooltip:shown", function() {
+ .on("shown.bs.tooltip", function() {
ok(false, "shown was called")
})
.tooltip('show')
@@ -103,10 +103,10 @@ $(function () {
test("should fire hide event", function () {
stop()
var tooltip = $('
')
- .bind("bs:tooltip:shown", function() {
+ .on("shown.bs.tooltip", function() {
$(this).tooltip('hide')
})
- .bind("bs:tooltip:hide", function() {
+ .on("hide.bs.tooltip", function() {
ok(true, "hide was called")
start()
})
@@ -116,10 +116,10 @@ $(function () {
test("should fire hidden event", function () {
stop()
var tooltip = $('
')
- .bind("bs:tooltip:shown", function() {
+ .on("shown.bs.tooltip", function() {
$(this).tooltip('hide')
})
- .bind("bs:tooltip:hidden", function() {
+ .on("hidden.bs.tooltip", function() {
ok(true, "hidden was called")
start()
})
@@ -129,15 +129,15 @@ $(function () {
test("should not fire hidden event when default prevented", function () {
stop()
var tooltip = $('
')
- .bind("bs:tooltip:shown", function() {
+ .on("shown.bs.tooltip", function() {
$(this).tooltip('hide')
})
- .bind("bs:tooltip:hide", function(e) {
+ .on("hide.bs.tooltip", function(e) {
e.preventDefault()
ok(true, "hide was called")
start()
})
- .bind("bs:tooltip:hidden", function() {
+ .on("hidden.bs.tooltip", function() {
ok(false, "hidden was called")
})
.tooltip('show')
@@ -214,13 +214,13 @@ $(function () {
test("should destroy tooltip", function () {
var tooltip = $('
').tooltip().on('click.foo', function(){})
- ok(tooltip.data('bs-tooltip'), 'tooltip has data')
+ ok(tooltip.data('bs.tooltip'), 'tooltip has data')
ok($._data(tooltip[0], 'events').mouseover && $._data(tooltip[0], 'events').mouseout, 'tooltip has hover event')
ok($._data(tooltip[0], 'events').click[0].namespace == 'foo', 'tooltip has extra click.foo event')
tooltip.tooltip('show')
tooltip.tooltip('destroy')
ok(!tooltip.hasClass('in'), 'tooltip is hidden')
- ok(!$._data(tooltip[0], 'bs-tooltip'), 'tooltip does not have data')
+ ok(!$._data(tooltip[0], 'bs.tooltip'), 'tooltip does not have data')
ok($._data(tooltip[0], 'events').click[0].namespace == 'foo', 'tooltip still has click.foo')
ok(!$._data(tooltip[0], 'events').mouseover && !$._data(tooltip[0], 'events').mouseout, 'tooltip does not have any events')
})
diff --git a/js/tooltip.js b/js/tooltip.js
index aa535d1962..be9ac251da 100644
--- a/js/tooltip.js
+++ b/js/tooltip.js
@@ -99,7 +99,7 @@
if (defaults[key] != value) options[key] = value
}, this)
- var self = $(e.currentTarget)[this.type](options).data('bs-' + this.type)
+ var self = $(e.currentTarget)[this.type](options).data('bs.' + this.type)
if (!self.options.delay || !self.options.delay.show) return self.show()
@@ -112,7 +112,7 @@
}
Tooltip.prototype.leave = function (e) {
- var self = $(e.currentTarget)[this.type](this._options).data('bs-' + this.type)
+ var self = $(e.currentTarget)[this.type](this._options).data('bs.' + this.type)
if (this.timeout) clearTimeout(this.timeout)
if (!self.options.delay || !self.options.delay.hide) return self.hide()
@@ -124,7 +124,7 @@
}
Tooltip.prototype.show = function () {
- var e = $.Event('bs:'+ this.type + ':show')
+ var e = $.Event('show.bs.'+ this.type)
if (this.hasContent() && this.enabled) {
this.$element.trigger(e)
@@ -168,7 +168,7 @@
}
this.applyPlacement(tp, placement)
- this.$element.trigger('bs:' + this.type + ':shown')
+ this.$element.trigger('shown.bs.' + this.type)
}
}
@@ -227,7 +227,7 @@
Tooltip.prototype.hide = function () {
var that = this
var $tip = this.tip()
- var e = $.Event('bs:' + this.type + ':hide')
+ var e = $.Event('hide.bs.' + this.type)
this.$element.trigger(e)
@@ -250,7 +250,7 @@
removeWithAnimation() :
$tip.detach()
- this.$element.trigger('bs:' + this.type + ':hidden')
+ this.$element.trigger('hidden.bs.' + this.type)
return this
}
@@ -314,12 +314,12 @@
}
Tooltip.prototype.toggle = function (e) {
- var self = e ? $(e.currentTarget)[this.type](this._options).data('bs-' + this.type) : this
+ var self = e ? $(e.currentTarget)[this.type](this._options).data('bs.' + this.type) : this
self.tip().hasClass('in') ? self.hide() : self.show()
}
Tooltip.prototype.destroy = function () {
- this.hide().$element.off('.' + this.type).removeData('bs-' + this.type)
+ this.hide().$element.off('.' + this.type).removeData('bs.' + this.type)
}
@@ -331,10 +331,10 @@
$.fn.tooltip = function (option) {
return this.each(function () {
var $this = $(this)
- var data = $this.data('bs-tooltip')
+ var data = $this.data('bs.tooltip')
var options = typeof option == 'object' && option
- if (!data) $this.data('bs-tooltip', (data = new Tooltip(this, options)))
+ if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
if (typeof option == 'string') data[option]()
})
}