2
0
mirror of https://github.com/tenrok/bootstrap.git synced 2026-06-20 20:00:36 +03:00

al tests passing, dist rebuilt, w/typechecker

This commit is contained in:
fat
2015-05-13 14:52:46 -07:00
parent eaab1def7a
commit 6b2b0ed32f
16 changed files with 308 additions and 63 deletions
+19 -4
View File
@@ -48,9 +48,17 @@
var Default = {
backdrop: true,
keyboard: true,
focus: true,
show: true
};
var DefaultType = {
backdrop: '(boolean|string)',
keyboard: 'boolean',
focus: 'boolean',
show: 'boolean'
};
var Event = {
HIDE: 'hide' + EVENT_KEY,
HIDDEN: 'hidden' + EVENT_KEY,
@@ -89,7 +97,7 @@
function Modal(element, config) {
_classCallCheck(this, Modal);
this._config = config;
this._config = this._getConfig(config);
this._element = element;
this._dialog = $(element).find(Selector.DIALOG)[0];
this._backdrop = null;
@@ -200,10 +208,17 @@
this._scrollbarWidth = null;
}
}, {
key: '_showElement',
key: '_getConfig',
// private
value: function _getConfig(config) {
config = $.extend({}, Default, config);
_Util.typeCheckConfig(NAME, config, DefaultType);
return config;
}
}, {
key: '_showElement',
value: function _showElement(relatedTarget) {
var _this2 = this;
@@ -223,14 +238,14 @@
$(this._element).addClass(ClassName.IN);
this._enforceFocus();
if (this._config.focus) this._enforceFocus();
var shownEvent = $.Event(Event.SHOWN, {
relatedTarget: relatedTarget
});
var transitionComplete = function transitionComplete() {
_this2._element.focus();
if (_this2._config.focus) _this2._element.focus();
$(_this2._element).trigger(shownEvent);
};