aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorMark Otto <[email protected]>2012-02-06 23:36:31 -0800
committerMark Otto <[email protected]>2012-02-06 23:36:31 -0800
commit4ed1b13719083fb9bb7ab7273cc9bf84482992cc (patch)
treefd67d1ffb5e9edfc549b5d21e389a9729e4f00ba /js
parent575b82473f8d248ca3782fa86ce1c92eea03905c (diff)
parent3722bb9a88e95b37ded12cb40a67ac396ce140fd (diff)
downloadbootstrap-4ed1b13719083fb9bb7ab7273cc9bf84482992cc.tar.xz
bootstrap-4ed1b13719083fb9bb7ab7273cc9bf84482992cc.zip
Merge branch 'raphaelz-patch-1' into 2.0.1-wip
Conflicts: docs/assets/bootstrap.zip
Diffstat (limited to 'js')
-rw-r--r--js/README.md4
-rw-r--r--js/bootstrap-modal.js7
-rw-r--r--js/tests/unit/bootstrap-alert.js4
3 files changed, 8 insertions, 7 deletions
diff --git a/js/README.md b/js/README.md
index b58fa1d40..3aa09c960 100644
--- a/js/README.md
+++ b/js/README.md
@@ -37,7 +37,7 @@ All methods should accept an optional options object, a string which targets a p
Options should be sparse and add universal value. We should pick the right defaults.
-All plugins should have a default object which can be modified to effect all instance's default options. The defaults object should be available via `$.fn.plugin.defaults`.
+All plugins should have a default object which can be modified to affect all instances' default options. The defaults object should be available via `$.fn.plugin.defaults`.
$.fn.modal.defaults = { … }
@@ -64,7 +64,7 @@ All events should have an infinitive and past participle form. The infinitive is
### CONSTRUCTORS
-Each plugin should expose it's raw constructor on a `Constructor` property -- accessed in the following way:
+Each plugin should expose its raw constructor on a `Constructor` property -- accessed in the following way:
$.fn.popover.Constructor
diff --git a/js/bootstrap-modal.js b/js/bootstrap-modal.js
index ba64368b2..180f0b64d 100644
--- a/js/bootstrap-modal.js
+++ b/js/bootstrap-modal.js
@@ -26,7 +26,7 @@
* ====================== */
var Modal = function ( content, options ) {
- this.options = $.extend({}, $.fn.modal.defaults, options)
+ this.options = options
this.$element = $(content)
.delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
}
@@ -177,16 +177,17 @@
return this.each(function () {
var $this = $(this)
, data = $this.data('modal')
- , options = typeof option == 'object' && option
+ , options = $.extend({}, $.fn.modal.defaults, typeof option == 'object' && option)
if (!data) $this.data('modal', (data = new Modal(this, options)))
if (typeof option == 'string') data[option]()
- else data.show()
+ else if (options.show) data.show()
})
}
$.fn.modal.defaults = {
backdrop: true
, keyboard: true
+ , show: true
}
$.fn.modal.Constructor = Modal
diff --git a/js/tests/unit/bootstrap-alert.js b/js/tests/unit/bootstrap-alert.js
index f961345c3..e607f4340 100644
--- a/js/tests/unit/bootstrap-alert.js
+++ b/js/tests/unit/bootstrap-alert.js
@@ -13,7 +13,7 @@ $(function () {
test("should fade element out on clicking .close", function () {
var alertHTML = '<div class="alert-message warning fade in">'
+ '<a class="close" href="#" data-dismiss="alert">×</a>'
- + '<p><strong>Holy guacamole!</strong> Best check yo self, you're not looking too good.</p>'
+ + '<p><strong>Holy guacamole!</strong> Best check yo self, you\'re not looking too good.</p>'
+ '</div>'
, alert = $(alertHTML).alert()
@@ -27,7 +27,7 @@ $(function () {
var alertHTML = '<div class="alert-message warning fade in">'
+ '<a class="close" href="#" data-dismiss="alert">×</a>'
- + '<p><strong>Holy guacamole!</strong> Best check yo self, you're not looking too good.</p>'
+ + '<p><strong>Holy guacamole!</strong> Best check yo self, you\'re not looking too good.</p>'
+ '</div>'
, alert = $(alertHTML).appendTo('#qunit-fixture').alert()