diff options
author | XhmikosR <xhmikosr@gmail.com> | 2020-05-13 21:53:43 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-13 21:53:43 +0300 |
commit | de7af5ee0738d08ef2d6702654834beb5bfce35e (patch) | |
tree | 371b751a7f96f96399e53d1767b8f0c4610cb268 /js/dist/modal.js | |
parent | 53eb7d38830f1e7c593069c8f5b40f4127563317 (diff) |
Dist (#30694)
Diffstat (limited to 'js/dist/modal.js')
-rw-r--r-- | js/dist/modal.js | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/js/dist/modal.js b/js/dist/modal.js index c7c81b1a55..476c02695f 100644 --- a/js/dist/modal.js +++ b/js/dist/modal.js @@ -213,8 +213,7 @@ var DATA_KEY = 'bs.modal'; var EVENT_KEY = "." + DATA_KEY; var DATA_API_KEY = '.data-api'; - var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key - + var ESCAPE_KEY = 'Escape'; var Default = { backdrop: true, keyboard: true, @@ -239,7 +238,6 @@ var EVENT_MOUSEUP_DISMISS = "mouseup.dismiss" + EVENT_KEY; var EVENT_MOUSEDOWN_DISMISS = "mousedown.dismiss" + EVENT_KEY; var EVENT_CLICK_DATA_API = "click" + EVENT_KEY + DATA_API_KEY; - var CLASS_NAME_SCROLLABLE = 'modal-dialog-scrollable'; var CLASS_NAME_SCROLLBAR_MEASURER = 'modal-scrollbar-measure'; var CLASS_NAME_BACKDROP = 'modal-backdrop'; var CLASS_NAME_OPEN = 'modal-open'; @@ -403,7 +401,7 @@ ; _proto._getConfig = function _getConfig(config) { - config = _objectSpread2({}, Default, {}, config); + config = _objectSpread2(_objectSpread2({}, Default), config); typeCheckConfig(NAME, config, DefaultType); return config; }; @@ -426,10 +424,10 @@ this._element.setAttribute('aria-modal', true); - if (this._dialog.classList.contains(CLASS_NAME_SCROLLABLE) && modalBody) { + this._element.scrollTop = 0; + + if (modalBody) { modalBody.scrollTop = 0; - } else { - this._element.scrollTop = 0; } if (transition) { @@ -479,11 +477,11 @@ if (this._isShown) { EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, function (event) { - if (_this5._config.keyboard && event.which === ESCAPE_KEYCODE) { + if (_this5._config.keyboard && event.key === ESCAPE_KEY) { event.preventDefault(); _this5.hide(); - } else if (!_this5._config.keyboard && event.which === ESCAPE_KEYCODE) { + } else if (!_this5._config.keyboard && event.key === ESCAPE_KEY) { _this5._triggerBackdropTransition(); } }); @@ -641,7 +639,7 @@ _proto._checkScrollbar = function _checkScrollbar() { var rect = document.body.getBoundingClientRect(); - this._isBodyOverflowing = rect.left + rect.right < window.innerWidth; + this._isBodyOverflowing = Math.round(rect.left + rect.right) < window.innerWidth; this._scrollbarWidth = this._getScrollbarWidth(); }; @@ -720,7 +718,7 @@ return this.each(function () { var data = Data.getData(this, DATA_KEY); - var _config = _objectSpread2({}, Default, {}, Manipulator.getDataAttributes(this), {}, typeof config === 'object' && config ? config : {}); + var _config = _objectSpread2(_objectSpread2(_objectSpread2({}, Default), Manipulator.getDataAttributes(this)), typeof config === 'object' && config ? config : {}); if (!data) { data = new Modal(this, _config); @@ -787,7 +785,7 @@ var data = Data.getData(target, DATA_KEY); if (!data) { - var config = _objectSpread2({}, Manipulator.getDataAttributes(target), {}, Manipulator.getDataAttributes(this)); + var config = _objectSpread2(_objectSpread2({}, Manipulator.getDataAttributes(target)), Manipulator.getDataAttributes(this)); data = new Modal(target, config); } |