assets/javascripts/bootstrap.js in bootstrap-4.5.0 vs assets/javascripts/bootstrap.js in bootstrap-4.5.2

- old
+ new

@@ -1,14 +1,14 @@ /*! - * Bootstrap v4.5.0 (https://getbootstrap.com/) + * Bootstrap v4.5.2 (https://getbootstrap.com/) * Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('jquery'), require('popper.js')) : typeof define === 'function' && define.amd ? define(['exports', 'jquery', 'popper.js'], factory) : - (global = global || self, factory(global.bootstrap = {}, global.jQuery, global.Popper)); + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.bootstrap = {}, global.jQuery, global.Popper)); }(this, (function (exports, $, Popper) { 'use strict'; $ = $ && Object.prototype.hasOwnProperty.call($, 'default') ? $['default'] : $; Popper = Popper && Object.prototype.hasOwnProperty.call(Popper, 'default') ? Popper['default'] : Popper; @@ -26,69 +26,38 @@ if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - function _defineProperty(obj, key, value) { - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; - } + function _extends() { + _extends = Object.assign || function (target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; - return obj; - } + for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } + } + } - function ownKeys(object, enumerableOnly) { - var keys = Object.keys(object); + return target; + }; - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols(object); - if (enumerableOnly) symbols = symbols.filter(function (sym) { - return Object.getOwnPropertyDescriptor(object, sym).enumerable; - }); - keys.push.apply(keys, symbols); - } - - return keys; + return _extends.apply(this, arguments); } - function _objectSpread2(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i] != null ? arguments[i] : {}; - - if (i % 2) { - ownKeys(Object(source), true).forEach(function (key) { - _defineProperty(target, key, source[key]); - }); - } else if (Object.getOwnPropertyDescriptors) { - Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); - } else { - ownKeys(Object(source)).forEach(function (key) { - Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); - }); - } - } - - return target; - } - function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } /** * -------------------------------------------------------------------------- - * Bootstrap (v4.5.0): util.js - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * Bootstrap (v4.5.2): util.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ /** * ------------------------------------------------------------------------ * Private TransitionEnd Helpers @@ -264,11 +233,11 @@ * Constants * ------------------------------------------------------------------------ */ var NAME = 'alert'; - var VERSION = '4.5.0'; + var VERSION = '4.5.2'; var DATA_KEY = 'bs.alert'; var EVENT_KEY = "." + DATA_KEY; var DATA_API_KEY = '.data-api'; var JQUERY_NO_CONFLICT = $.fn[NAME]; var SELECTOR_DISMISS = '[data-dismiss="alert"]'; @@ -420,11 +389,11 @@ * Constants * ------------------------------------------------------------------------ */ var NAME$1 = 'button'; - var VERSION$1 = '4.5.0'; + var VERSION$1 = '4.5.2'; var DATA_KEY$1 = 'bs.button'; var EVENT_KEY$1 = "." + DATA_KEY$1; var DATA_API_KEY$1 = '.data-api'; var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1]; var CLASS_NAME_ACTIVE = 'active'; @@ -555,15 +524,13 @@ event.preventDefault(); // work around Firefox bug #1540995 return; } - if (initialButton.tagName === 'LABEL' && inputBtn && inputBtn.type === 'checkbox') { - event.preventDefault(); // work around event sent to label and input + if (initialButton.tagName !== 'LABEL' || inputBtn && inputBtn.type !== 'checkbox') { + Button._jQueryInterface.call($(button), 'toggle'); } - - Button._jQueryInterface.call($(button), 'toggle'); } }).on(EVENT_FOCUS_BLUR_DATA_API, SELECTOR_DATA_TOGGLE_CARROT, function (event) { var button = $(event.target).closest(SELECTOR_BUTTON)[0]; $(button).toggleClass(CLASS_NAME_FOCUS, /^focus(in)?$/.test(event.type)); }); @@ -615,11 +582,11 @@ * Constants * ------------------------------------------------------------------------ */ var NAME$2 = 'carousel'; - var VERSION$2 = '4.5.0'; + var VERSION$2 = '4.5.2'; var DATA_KEY$2 = 'bs.carousel'; var EVENT_KEY$2 = "." + DATA_KEY$2; var DATA_API_KEY$2 = '.data-api'; var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2]; var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key @@ -802,11 +769,11 @@ this._indicatorsElement = null; } // Private ; _proto._getConfig = function _getConfig(config) { - config = _objectSpread2(_objectSpread2({}, Default), config); + config = _extends({}, Default, config); Util.typeCheckConfig(NAME$2, config, DefaultType); return config; }; _proto._handleSwipe = function _handleSwipe() { @@ -1092,14 +1059,14 @@ Carousel._jQueryInterface = function _jQueryInterface(config) { return this.each(function () { var data = $(this).data(DATA_KEY$2); - var _config = _objectSpread2(_objectSpread2({}, Default), $(this).data()); + var _config = _extends({}, Default, $(this).data()); if (typeof config === 'object') { - _config = _objectSpread2(_objectSpread2({}, _config), config); + _config = _extends({}, _config, config); } var action = typeof config === 'string' ? config : _config.slide; if (!data) { @@ -1133,11 +1100,11 @@ if (!target || !$(target).hasClass(CLASS_NAME_CAROUSEL)) { return; } - var config = _objectSpread2(_objectSpread2({}, $(target).data()), $(this).data()); + var config = _extends({}, $(target).data(), $(this).data()); var slideIndex = this.getAttribute('data-slide-to'); if (slideIndex) { config.interval = false; @@ -1202,11 +1169,11 @@ * Constants * ------------------------------------------------------------------------ */ var NAME$3 = 'collapse'; - var VERSION$3 = '4.5.0'; + var VERSION$3 = '4.5.2'; var DATA_KEY$3 = 'bs.collapse'; var EVENT_KEY$3 = "." + DATA_KEY$3; var DATA_API_KEY$3 = '.data-api'; var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3]; var Default$1 = { @@ -1417,11 +1384,11 @@ this._isTransitioning = null; } // Private ; _proto._getConfig = function _getConfig(config) { - config = _objectSpread2(_objectSpread2({}, Default$1), config); + config = _extends({}, Default$1, config); config.toggle = Boolean(config.toggle); // Coerce string values Util.typeCheckConfig(NAME$3, config, DefaultType$1); return config; }; @@ -1471,11 +1438,11 @@ Collapse._jQueryInterface = function _jQueryInterface(config) { return this.each(function () { var $this = $(this); var data = $this.data(DATA_KEY$3); - var _config = _objectSpread2(_objectSpread2(_objectSpread2({}, Default$1), $this.data()), typeof config === 'object' && config ? config : {}); + var _config = _extends({}, Default$1, $this.data(), typeof config === 'object' && config ? config : {}); if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) { _config.toggle = false; } @@ -1551,11 +1518,11 @@ * Constants * ------------------------------------------------------------------------ */ var NAME$4 = 'dropdown'; - var VERSION$4 = '4.5.0'; + var VERSION$4 = '4.5.2'; var DATA_KEY$4 = 'bs.dropdown'; var EVENT_KEY$4 = "." + DATA_KEY$4; var DATA_API_KEY$4 = '.data-api'; var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4]; var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key @@ -1778,11 +1745,11 @@ _this.toggle(); }); }; _proto._getConfig = function _getConfig(config) { - config = _objectSpread2(_objectSpread2(_objectSpread2({}, this.constructor.Default), $(this._element).data()), config); + config = _extends({}, this.constructor.Default, $(this._element).data(), config); Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType); return config; }; _proto._getMenuElement = function _getMenuElement() { @@ -1823,11 +1790,11 @@ var offset = {}; if (typeof this._config.offset === 'function') { offset.fn = function (data) { - data.offsets = _objectSpread2(_objectSpread2({}, data.offsets), _this2._config.offset(data.offsets, _this2._element) || {}); + data.offsets = _extends({}, data.offsets, _this2._config.offset(data.offsets, _this2._element) || {}); return data; }; } else { offset.offset = this._config.offset; } @@ -1853,11 +1820,11 @@ popperConfig.modifiers.applyStyle = { enabled: false }; } - return _objectSpread2(_objectSpread2({}, popperConfig), this._config.popperConfig); + return _extends({}, popperConfig, this._config.popperConfig); } // Static ; Dropdown._jQueryInterface = function _jQueryInterface(config) { return this.each(function () { @@ -2065,11 +2032,11 @@ * Constants * ------------------------------------------------------------------------ */ var NAME$5 = 'modal'; - var VERSION$5 = '4.5.0'; + var VERSION$5 = '4.5.2'; var DATA_KEY$5 = 'bs.modal'; var EVENT_KEY$5 = "." + DATA_KEY$5; var DATA_API_KEY$5 = '.data-api'; var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5]; var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key @@ -2257,11 +2224,11 @@ this._adjustDialog(); } // Private ; _proto._getConfig = function _getConfig(config) { - config = _objectSpread2(_objectSpread2({}, Default$3), config); + config = _extends({}, Default$3, config); Util.typeCheckConfig(NAME$5, config, DefaultType$3); return config; }; _proto._triggerBackdropTransition = function _triggerBackdropTransition() { @@ -2273,15 +2240,28 @@ if (hideEventPrevented.defaultPrevented) { return; } + var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; + + if (!isModalOverflowing) { + this._element.style.overflowY = 'hidden'; + } + this._element.classList.add(CLASS_NAME_STATIC); - var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element); + var modalTransitionDuration = Util.getTransitionDurationFromElement(this._dialog); + $(this._element).off(Util.TRANSITION_END); $(this._element).one(Util.TRANSITION_END, function () { _this3._element.classList.remove(CLASS_NAME_STATIC); + + if (!isModalOverflowing) { + $(_this3._element).one(Util.TRANSITION_END, function () { + _this3._element.style.overflowY = ''; + }).emulateTransitionEnd(_this3._element, modalTransitionDuration); + } }).emulateTransitionEnd(modalTransitionDuration); this._element.focus(); } else { this.hide(); @@ -2303,10 +2283,12 @@ this._element.removeAttribute('aria-hidden'); this._element.setAttribute('aria-modal', true); + this._element.setAttribute('role', 'dialog'); + if ($(this._dialog).hasClass(CLASS_NAME_SCROLLABLE) && modalBody) { modalBody.scrollTop = 0; } else { this._element.scrollTop = 0; } @@ -2390,10 +2372,12 @@ this._element.setAttribute('aria-hidden', true); this._element.removeAttribute('aria-modal'); + this._element.removeAttribute('role'); + this._isTransitioning = false; this._showBackdrop(function () { $(document.body).removeClass(CLASS_NAME_OPEN); @@ -2571,11 +2555,11 @@ Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) { return this.each(function () { var data = $(this).data(DATA_KEY$5); - var _config = _objectSpread2(_objectSpread2(_objectSpread2({}, Default$3), $(this).data()), typeof config === 'object' && config ? config : {}); + var _config = _extends({}, Default$3, $(this).data(), typeof config === 'object' && config ? config : {}); if (!data) { data = new Modal(this, _config); $(this).data(DATA_KEY$5, data); } @@ -2621,11 +2605,11 @@ if (selector) { target = document.querySelector(selector); } - var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2(_objectSpread2({}, $(target).data()), $(this).data()); + var config = $(target).data(DATA_KEY$5) ? 'toggle' : _extends({}, $(target).data(), $(this).data()); if (this.tagName === 'A' || this.tagName === 'AREA') { event.preventDefault(); } @@ -2658,12 +2642,12 @@ return Modal._jQueryInterface; }; /** * -------------------------------------------------------------------------- - * Bootstrap (v4.5.0): tools/sanitizer.js - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * Bootstrap (v4.5.2): tools/sanitizer.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']; var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i; var DefaultWhitelist = { @@ -2784,11 +2768,11 @@ * Constants * ------------------------------------------------------------------------ */ var NAME$6 = 'tooltip'; - var VERSION$6 = '4.5.0'; + var VERSION$6 = '4.5.2'; var DATA_KEY$6 = 'bs.tooltip'; var EVENT_KEY$6 = "." + DATA_KEY$6; var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6]; var CLASS_PREFIX = 'bs-tooltip'; var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g'); @@ -3172,21 +3156,21 @@ }, onUpdate: function onUpdate(data) { return _this3._handlePopperPlacementChange(data); } }; - return _objectSpread2(_objectSpread2({}, defaultBsConfig), this.config.popperConfig); + return _extends({}, defaultBsConfig, this.config.popperConfig); }; _proto._getOffset = function _getOffset() { var _this4 = this; var offset = {}; if (typeof this.config.offset === 'function') { offset.fn = function (data) { - data.offsets = _objectSpread2(_objectSpread2({}, data.offsets), _this4.config.offset(data.offsets, _this4.element) || {}); + data.offsets = _extends({}, data.offsets, _this4.config.offset(data.offsets, _this4.element) || {}); return data; }; } else { offset.offset = this.config.offset; } @@ -3237,11 +3221,11 @@ }; $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler); if (this.config.selector) { - this.config = _objectSpread2(_objectSpread2({}, this.config), {}, { + this.config = _extends({}, this.config, { trigger: 'manual', selector: '' }); } else { this._fixTitle(); @@ -3337,11 +3321,11 @@ Object.keys(dataAttributes).forEach(function (dataAttr) { if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) { delete dataAttributes[dataAttr]; } }); - config = _objectSpread2(_objectSpread2(_objectSpread2({}, this.constructor.Default), dataAttributes), typeof config === 'object' && config ? config : {}); + config = _extends({}, this.constructor.Default, dataAttributes, typeof config === 'object' && config ? config : {}); if (typeof config.delay === 'number') { config.delay = { show: config.delay, hide: config.delay @@ -3496,25 +3480,25 @@ * Constants * ------------------------------------------------------------------------ */ var NAME$7 = 'popover'; - var VERSION$7 = '4.5.0'; + var VERSION$7 = '4.5.2'; var DATA_KEY$7 = 'bs.popover'; var EVENT_KEY$7 = "." + DATA_KEY$7; var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7]; var CLASS_PREFIX$1 = 'bs-popover'; var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g'); - var Default$5 = _objectSpread2(_objectSpread2({}, Tooltip.Default), {}, { + var Default$5 = _extends({}, Tooltip.Default, { placement: 'right', trigger: 'click', content: '', template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>' }); - var DefaultType$5 = _objectSpread2(_objectSpread2({}, Tooltip.DefaultType), {}, { + var DefaultType$5 = _extends({}, Tooltip.DefaultType, { content: '(string|element|function)' }); var CLASS_NAME_FADE$3 = 'fade'; var CLASS_NAME_SHOW$5 = 'show'; @@ -3676,11 +3660,11 @@ * Constants * ------------------------------------------------------------------------ */ var NAME$8 = 'scrollspy'; - var VERSION$8 = '4.5.0'; + var VERSION$8 = '4.5.2'; var DATA_KEY$8 = 'bs.scrollspy'; var EVENT_KEY$8 = "." + DATA_KEY$8; var DATA_API_KEY$6 = '.data-api'; var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8]; var Default$6 = { @@ -3790,11 +3774,11 @@ this._scrollHeight = null; } // Private ; _proto._getConfig = function _getConfig(config) { - config = _objectSpread2(_objectSpread2({}, Default$6), typeof config === 'object' && config ? config : {}); + config = _extends({}, Default$6, typeof config === 'object' && config ? config : {}); if (typeof config.target !== 'string' && Util.isElement(config.target)) { var id = $(config.target).attr('id'); if (!id) { @@ -3968,11 +3952,11 @@ * Constants * ------------------------------------------------------------------------ */ var NAME$9 = 'tab'; - var VERSION$9 = '4.5.0'; + var VERSION$9 = '4.5.2'; var DATA_KEY$9 = 'bs.tab'; var EVENT_KEY$9 = "." + DATA_KEY$9; var DATA_API_KEY$7 = '.data-api'; var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9]; var EVENT_HIDE$3 = "hide" + EVENT_KEY$9; @@ -4194,11 +4178,11 @@ * Constants * ------------------------------------------------------------------------ */ var NAME$a = 'toast'; - var VERSION$a = '4.5.0'; + var VERSION$a = '4.5.2'; var DATA_KEY$a = 'bs.toast'; var EVENT_KEY$a = "." + DATA_KEY$a; var JQUERY_NO_CONFLICT$a = $.fn[NAME$a]; var EVENT_CLICK_DISMISS$1 = "click.dismiss" + EVENT_KEY$a; var EVENT_HIDE$4 = "hide" + EVENT_KEY$a; @@ -4247,10 +4231,12 @@ if (showEvent.isDefaultPrevented()) { return; } + this._clearTimeout(); + if (this._config.animation) { this._element.classList.add(CLASS_NAME_FADE$5); } var complete = function complete() { @@ -4295,12 +4281,11 @@ this._close(); }; _proto.dispose = function dispose() { - clearTimeout(this._timeout); - this._timeout = null; + this._clearTimeout(); if (this._element.classList.contains(CLASS_NAME_SHOW$7)) { this._element.classList.remove(CLASS_NAME_SHOW$7); } @@ -4310,11 +4295,11 @@ this._config = null; } // Private ; _proto._getConfig = function _getConfig(config) { - config = _objectSpread2(_objectSpread2(_objectSpread2({}, Default$7), $(this._element).data()), typeof config === 'object' && config ? config : {}); + config = _extends({}, Default$7, $(this._element).data(), typeof config === 'object' && config ? config : {}); Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType); return config; }; _proto._setListeners = function _setListeners() { @@ -4340,9 +4325,14 @@ var transitionDuration = Util.getTransitionDurationFromElement(this._element); $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); } else { complete(); } + }; + + _proto._clearTimeout = function _clearTimeout() { + clearTimeout(this._timeout); + this._timeout = null; } // Static ; Toast._jQueryInterface = function _jQueryInterface(config) { return this.each(function () {