1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-17 19:06:40 +02:00
This commit is contained in:
Mark Otto
2018-01-11 22:42:40 -08:00
parent 80d0943b95
commit 6d8d8639f3
42 changed files with 356 additions and 385 deletions

18
js/dist/modal.js vendored
View File

@@ -86,12 +86,12 @@ var Modal = function ($) {
this._ignoreBackdropClick = false;
this._originalBodyPadding = 0;
this._scrollbarWidth = 0;
} // getters
} // Getters
var _proto = Modal.prototype;
// public
// Public
_proto.toggle = function toggle(relatedTarget) {
return this._isShown ? this.hide() : this.show(relatedTarget);
};
@@ -204,7 +204,7 @@ var Modal = function ($) {
_proto.handleUpdate = function handleUpdate() {
this._adjustDialog();
}; // private
}; // Private
_proto._getConfig = function _getConfig(config) {
@@ -219,7 +219,7 @@ var Modal = function ($) {
var transition = Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE);
if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
// don't move modals dom position
// Don't move modal's DOM position
document.body.appendChild(this._element);
}
@@ -262,9 +262,9 @@ var Modal = function ($) {
_proto._enforceFocus = function _enforceFocus() {
var _this4 = this;
$(document).off(Event.FOCUSIN) // guard against infinite focus loop
$(document).off(Event.FOCUSIN) // Guard against infinite focus loop
.on(Event.FOCUSIN, function (event) {
if (document !== event.target && _this4._element !== event.target && !$(_this4._element).has(event.target).length) {
if (document !== event.target && _this4._element !== event.target && $(_this4._element).has(event.target).length === 0) {
_this4._element.focus();
}
});
@@ -485,7 +485,7 @@ var Modal = function ($) {
var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
document.body.removeChild(scrollDiv);
return scrollbarWidth;
}; // static
}; // Static
Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
@@ -501,7 +501,7 @@ var Modal = function ($) {
if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
throw new Error("No method named \"" + config + "\"");
throw new TypeError("No method named \"" + config + "\"");
}
data[config](relatedTarget);
@@ -550,7 +550,7 @@ var Modal = function ($) {
var $target = $(target).one(Event.SHOW, function (showEvent) {
if (showEvent.isDefaultPrevented()) {
// only register focus restorer if modal will actually get shown
// Only register focus restorer if modal will actually get shown
return;
}