assets/javascripts/bootstrap.js in bootstrap-5.0.0.alpha1 vs assets/javascripts/bootstrap.js in bootstrap-5.0.0.alpha2
- old
+ new
@@ -1,18 +1,20 @@
/*!
- * Bootstrap v5.0.0-alpha1 (https://getbootstrap.com/)
+ * Bootstrap v5.0.0-alpha2 (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/main/LICENSE)
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('popper.js')) :
typeof define === 'function' && define.amd ? define(['popper.js'], factory) :
- (global = global || self, global.bootstrap = factory(global.Popper));
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.bootstrap = factory(global.Popper));
}(this, (function (Popper) { 'use strict';
- Popper = Popper && Object.prototype.hasOwnProperty.call(Popper, 'default') ? Popper['default'] : Popper;
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
+ var Popper__default = /*#__PURE__*/_interopDefaultLegacy(Popper);
+
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
@@ -25,68 +27,37 @@
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 (v5.0.0-alpha1): util/index.js
+ * Bootstrap (v5.0.0-alpha2): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
var MAX_UID = 1000000;
var MILLISECONDS_MULTIPLIER = 1000;
@@ -257,11 +228,11 @@
return null;
};
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.0-alpha1): dom/data.js
+ * Bootstrap (v5.0.0-alpha2): dom/data.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
/**
@@ -272,43 +243,43 @@
var mapData = function () {
var storeData = {};
var id = 1;
return {
set: function set(element, key, data) {
- if (typeof element.key === 'undefined') {
- element.key = {
+ if (typeof element.bsKey === 'undefined') {
+ element.bsKey = {
key: key,
id: id
};
id++;
}
- storeData[element.key.id] = data;
+ storeData[element.bsKey.id] = data;
},
get: function get(element, key) {
- if (!element || typeof element.key === 'undefined') {
+ if (!element || typeof element.bsKey === 'undefined') {
return null;
}
- var keyProperties = element.key;
+ var keyProperties = element.bsKey;
if (keyProperties.key === key) {
return storeData[keyProperties.id];
}
return null;
},
delete: function _delete(element, key) {
- if (typeof element.key === 'undefined') {
+ if (typeof element.bsKey === 'undefined') {
return;
}
- var keyProperties = element.key;
+ var keyProperties = element.bsKey;
if (keyProperties.key === key) {
delete storeData[keyProperties.id];
- delete element.key;
+ delete element.bsKey;
}
}
};
}();
@@ -396,11 +367,11 @@
};
}
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.0-alpha1): dom/event-handler.js
+ * Bootstrap (v5.0.0-alpha2): dom/event-handler.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
/**
* ------------------------------------------------------------------------
@@ -437,10 +408,12 @@
return eventRegistry[uid];
}
function bootstrapHandler(element, fn) {
return function handler(event) {
+ event.delegateTarget = element;
+
if (handler.oneOff) {
EventHandler.off(element, event.type, fn);
}
return fn.apply(element, [event]);
@@ -452,10 +425,12 @@
var domElements = element.querySelectorAll(selector);
for (var target = event.target; target && target !== this; target = target.parentNode) {
for (var i = domElements.length; i--;) {
if (domElements[i] === target) {
+ event.delegateTarget = target;
+
if (handler.oneOff) {
EventHandler.off(element, event.type, fn);
}
return fn.apply(target, [event]);
@@ -636,11 +611,11 @@
} else {
evt = new CustomEvent(event, {
bubbles: bubbles,
cancelable: true
});
- } // merge custom informations in our event
+ } // merge custom information in our event
if (typeof args !== 'undefined') {
Object.keys(args).forEach(function (key) {
Object.defineProperty(evt, key, {
@@ -680,11 +655,11 @@
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'alert';
- var VERSION = '5.0.0-alpha1';
+ var VERSION = '5.0.0-alpha2';
var DATA_KEY = 'bs.alert';
var EVENT_KEY = "." + DATA_KEY;
var DATA_API_KEY = '.data-api';
var SELECTOR_DISMISS = '[data-dismiss="alert"]';
var EVENT_CLOSE = "close" + EVENT_KEY;
@@ -711,16 +686,12 @@
var _proto = Alert.prototype;
// Public
_proto.close = function close(element) {
- var rootElement = this._element;
+ var rootElement = element ? this._getRootElement(element) : this._element;
- if (element) {
- rootElement = this._getRootElement(element);
- }
-
var customEvent = this._triggerCloseEvent(rootElement);
if (customEvent === null || customEvent.defaultPrevented) {
return;
}
@@ -840,11 +811,11 @@
* Constants
* ------------------------------------------------------------------------
*/
var NAME$1 = 'button';
- var VERSION$1 = '5.0.0-alpha1';
+ var VERSION$1 = '5.0.0-alpha2';
var DATA_KEY$1 = 'bs.button';
var EVENT_KEY$1 = "." + DATA_KEY$1;
var DATA_API_KEY$1 = '.data-api';
var CLASS_NAME_ACTIVE = 'active';
var SELECTOR_DATA_TOGGLE = '[data-toggle="button"]';
@@ -942,11 +913,11 @@
};
}
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.0-alpha1): dom/manipulator.js
+ * Bootstrap (v5.0.0-alpha2): dom/manipulator.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
function normalizeData(val) {
if (val === 'true') {
@@ -984,11 +955,11 @@
getDataAttributes: function getDataAttributes(element) {
if (!element) {
return {};
}
- var attributes = _objectSpread2({}, element.dataset);
+ var attributes = _extends({}, element.dataset);
Object.keys(attributes).forEach(function (key) {
attributes[key] = normalizeData(attributes[key]);
});
return attributes;
@@ -1022,11 +993,11 @@
}
};
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.0-alpha1): dom/selector-engine.js
+ * Bootstrap (v5.0.0-alpha2): dom/selector-engine.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
/**
* ------------------------------------------------------------------------
@@ -1111,11 +1082,11 @@
* Constants
* ------------------------------------------------------------------------
*/
var NAME$2 = 'carousel';
- var VERSION$2 = '5.0.0-alpha1';
+ var VERSION$2 = '5.0.0-alpha2';
var DATA_KEY$2 = 'bs.carousel';
var EVENT_KEY$2 = "." + DATA_KEY$2;
var DATA_API_KEY$2 = '.data-api';
var ARROW_LEFT_KEY = 'ArrowLeft';
var ARROW_RIGHT_KEY = 'ArrowRight';
@@ -1297,11 +1268,11 @@
this._indicatorsElement = null;
} // Private
;
_proto._getConfig = function _getConfig(config) {
- config = _objectSpread2(_objectSpread2({}, Default), config);
+ config = _extends({}, Default, config);
typeCheckConfig(NAME$2, config, DefaultType);
return config;
};
_proto._handleSwipe = function _handleSwipe() {
@@ -1591,14 +1562,14 @@
;
Carousel.carouselInterface = function carouselInterface(element, config) {
var data = Data.getData(element, DATA_KEY$2);
- var _config = _objectSpread2(_objectSpread2({}, Default), Manipulator.getDataAttributes(element));
+ var _config = _extends({}, Default, Manipulator.getDataAttributes(element));
if (typeof config === 'object') {
- _config = _objectSpread2(_objectSpread2({}, _config), config);
+ _config = _extends({}, _config, config);
}
var action = typeof config === 'string' ? config : _config.slide;
if (!data) {
@@ -1630,11 +1601,11 @@
if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) {
return;
}
- var config = _objectSpread2(_objectSpread2({}, Manipulator.getDataAttributes(target)), Manipulator.getDataAttributes(this));
+ var config = _extends({}, Manipulator.getDataAttributes(target), Manipulator.getDataAttributes(this));
var slideIndex = this.getAttribute('data-slide-to');
if (slideIndex) {
config.interval = false;
@@ -1708,11 +1679,11 @@
* Constants
* ------------------------------------------------------------------------
*/
var NAME$3 = 'collapse';
- var VERSION$3 = '5.0.0-alpha1';
+ var VERSION$3 = '5.0.0-alpha2';
var DATA_KEY$3 = 'bs.collapse';
var EVENT_KEY$3 = "." + DATA_KEY$3;
var DATA_API_KEY$3 = '.data-api';
var Default$1 = {
toggle: true,
@@ -1947,21 +1918,19 @@
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
typeCheckConfig(NAME$3, config, DefaultType$1);
return config;
};
_proto._getDimension = function _getDimension() {
- var hasWidth = this._element.classList.contains(WIDTH);
-
- return hasWidth ? WIDTH : HEIGHT;
+ return this._element.classList.contains(WIDTH) ? WIDTH : HEIGHT;
};
_proto._getParent = function _getParent() {
var _this3 = this;
@@ -1984,32 +1953,31 @@
});
return parent;
};
_proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
- if (element) {
- var isOpen = element.classList.contains(CLASS_NAME_SHOW);
+ if (!element || !triggerArray.length) {
+ return;
+ }
- if (triggerArray.length) {
- triggerArray.forEach(function (elem) {
- if (isOpen) {
- elem.classList.remove(CLASS_NAME_COLLAPSED);
- } else {
- elem.classList.add(CLASS_NAME_COLLAPSED);
- }
-
- elem.setAttribute('aria-expanded', isOpen);
- });
+ var isOpen = element.classList.contains(CLASS_NAME_SHOW);
+ triggerArray.forEach(function (elem) {
+ if (isOpen) {
+ elem.classList.remove(CLASS_NAME_COLLAPSED);
+ } else {
+ elem.classList.add(CLASS_NAME_COLLAPSED);
}
- }
+
+ elem.setAttribute('aria-expanded', isOpen);
+ });
} // Static
;
Collapse.collapseInterface = function collapseInterface(element, config) {
var data = Data.getData(element, DATA_KEY$3);
- var _config = _objectSpread2(_objectSpread2(_objectSpread2({}, Default$1), Manipulator.getDataAttributes(element)), typeof config === 'object' && config ? config : {});
+ var _config = _extends({}, Default$1, Manipulator.getDataAttributes(element), typeof config === 'object' && config ? config : {});
if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) {
_config.toggle = false;
}
@@ -2111,11 +2079,11 @@
* Constants
* ------------------------------------------------------------------------
*/
var NAME$4 = 'dropdown';
- var VERSION$4 = '5.0.0-alpha1';
+ var VERSION$4 = '5.0.0-alpha2';
var DATA_KEY$4 = 'bs.dropdown';
var EVENT_KEY$4 = "." + DATA_KEY$4;
var DATA_API_KEY$4 = '.data-api';
var ESCAPE_KEY = 'Escape';
var SPACE_KEY = 'Space';
@@ -2222,11 +2190,11 @@
return;
} // Disable totally Popper.js for Dropdown in Navbar
if (!this._inNavbar) {
- if (typeof Popper === 'undefined') {
+ if (typeof Popper__default['default'] === 'undefined') {
throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org)');
}
var referenceElement = this._element;
@@ -2245,11 +2213,11 @@
if (this._config.boundary !== 'scrollParent') {
parent.classList.add(CLASS_NAME_POSITION_STATIC);
}
- this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
+ this._popper = new Popper__default['default'](referenceElement, this._menu, this._getPopperConfig());
} // If this is a touch-enabled device we add extra
// empty mouseover listeners to the body's immediate children;
// only needed because of broken event delegation on iOS
// https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
@@ -2327,11 +2295,11 @@
_this.toggle();
});
};
_proto._getConfig = function _getConfig(config) {
- config = _objectSpread2(_objectSpread2(_objectSpread2({}, this.constructor.Default), Manipulator.getDataAttributes(this._element)), config);
+ config = _extends({}, this.constructor.Default, Manipulator.getDataAttributes(this._element), config);
typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
return config;
};
_proto._getMenuElement = function _getMenuElement() {
@@ -2368,11 +2336,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;
}
@@ -2398,11 +2366,11 @@
popperConfig.modifiers.applyStyle = {
enabled: false
};
}
- return _objectSpread2(_objectSpread2({}, popperConfig), this._config.popperConfig);
+ return _extends({}, popperConfig, this._config.popperConfig);
} // Static
;
Dropdown.dropdownInterface = function dropdownInterface(element, config) {
var data = Data.getData(element, DATA_KEY$4);
@@ -2617,11 +2585,11 @@
* Constants
* ------------------------------------------------------------------------
*/
var NAME$5 = 'modal';
- var VERSION$5 = '5.0.0-alpha1';
+ var VERSION$5 = '5.0.0-alpha2';
var DATA_KEY$5 = 'bs.modal';
var EVENT_KEY$5 = "." + DATA_KEY$5;
var DATA_API_KEY$5 = '.data-api';
var ESCAPE_KEY$1 = 'Escape';
var Default$3 = {
@@ -2809,11 +2777,11 @@
this._adjustDialog();
} // Private
;
_proto._getConfig = function _getConfig(config) {
- config = _objectSpread2(_objectSpread2({}, Default$3), config);
+ config = _extends({}, Default$3, config);
typeCheckConfig(NAME$5, config, DefaultType$3);
return config;
};
_proto._showElement = function _showElement(relatedTarget) {
@@ -3015,15 +2983,29 @@
if (hideEvent.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 = getTransitionDurationFromElement(this._element);
+ var modalTransitionDuration = getTransitionDurationFromElement(this._dialog);
+ EventHandler.off(this._element, TRANSITION_END);
EventHandler.one(this._element, TRANSITION_END, function () {
_this9._element.classList.remove(CLASS_NAME_STATIC);
+
+ if (!isModalOverflowing) {
+ EventHandler.one(_this9._element, TRANSITION_END, function () {
+ _this9._element.style.overflowY = '';
+ });
+ emulateTransitionEnd(_this9._element, modalTransitionDuration);
+ }
});
emulateTransitionEnd(this._element, modalTransitionDuration);
this._element.focus();
} else {
@@ -3130,11 +3112,11 @@
Modal.jQueryInterface = function jQueryInterface(config, relatedTarget) {
return this.each(function () {
var data = Data.getData(this, DATA_KEY$5);
- var _config = _objectSpread2(_objectSpread2(_objectSpread2({}, Default$3), Manipulator.getDataAttributes(this)), typeof config === 'object' && config ? config : {});
+ var _config = _extends({}, Default$3, Manipulator.getDataAttributes(this), typeof config === 'object' && config ? config : {});
if (!data) {
data = new Modal(this, _config);
}
@@ -3197,11 +3179,11 @@
});
});
var data = Data.getData(target, DATA_KEY$5);
if (!data) {
- var config = _objectSpread2(_objectSpread2({}, Manipulator.getDataAttributes(target)), Manipulator.getDataAttributes(this));
+ var config = _extends({}, Manipulator.getDataAttributes(target), Manipulator.getDataAttributes(this));
data = new Modal(target, config);
}
data.show(this);
@@ -3227,11 +3209,11 @@
};
}
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.0-alpha1): util/sanitizer.js
+ * Bootstrap (v5.0.0-alpha2): util/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;
@@ -3272,11 +3254,11 @@
}
return false;
};
- var DefaultWhitelist = {
+ var DefaultAllowlist = {
// Global attributes allowed on any supplied element below.
'*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
a: ['target', 'href', 'title', 'rel'],
area: [],
b: [],
@@ -3305,11 +3287,11 @@
sup: [],
strong: [],
u: [],
ul: []
};
- function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
+ function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) {
var _ref;
if (!unsafeHtml.length) {
return unsafeHtml;
}
@@ -3318,30 +3300,30 @@
return sanitizeFn(unsafeHtml);
}
var domParser = new window.DOMParser();
var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
- var whitelistKeys = Object.keys(whiteList);
+ var allowlistKeys = Object.keys(allowList);
var elements = (_ref = []).concat.apply(_ref, createdDocument.body.querySelectorAll('*'));
var _loop = function _loop(i, len) {
var _ref2;
var el = elements[i];
var elName = el.nodeName.toLowerCase();
- if (whitelistKeys.indexOf(elName) === -1) {
+ if (allowlistKeys.indexOf(elName) === -1) {
el.parentNode.removeChild(el);
return "continue";
}
var attributeList = (_ref2 = []).concat.apply(_ref2, el.attributes);
- var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
+ var allowedAttributes = [].concat(allowList['*'] || [], allowList[elName] || []);
attributeList.forEach(function (attr) {
- if (!allowedAttribute(attr, whitelistedAttributes)) {
+ if (!allowedAttribute(attr, allowedAttributes)) {
el.removeAttribute(attr.nodeName);
}
});
};
@@ -3359,16 +3341,16 @@
* Constants
* ------------------------------------------------------------------------
*/
var NAME$6 = 'tooltip';
- var VERSION$6 = '5.0.0-alpha1';
+ var VERSION$6 = '5.0.0-alpha2';
var DATA_KEY$6 = 'bs.tooltip';
var EVENT_KEY$6 = "." + DATA_KEY$6;
var CLASS_PREFIX = 'bs-tooltip';
var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
- var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
+ var DISALLOWED_ATTRIBUTES = ['sanitize', 'allowList', 'sanitizeFn'];
var DefaultType$4 = {
animation: 'boolean',
template: 'string',
title: '(string|element|function)',
trigger: 'string',
@@ -3380,11 +3362,11 @@
container: '(string|element|boolean)',
fallbackPlacement: '(string|array)',
boundary: '(string|element)',
sanitize: 'boolean',
sanitizeFn: '(null|function)',
- whiteList: 'object',
+ allowList: 'object',
popperConfig: '(null|object)'
};
var AttachmentMap = {
AUTO: 'auto',
TOP: 'top',
@@ -3405,11 +3387,11 @@
container: false,
fallbackPlacement: 'flip',
boundary: 'scrollParent',
sanitize: true,
sanitizeFn: null,
- whiteList: DefaultWhitelist,
+ allowList: DefaultAllowlist,
popperConfig: null
};
var Event$1 = {
HIDE: "hide" + EVENT_KEY$6,
HIDDEN: "hidden" + EVENT_KEY$6,
@@ -3438,11 +3420,11 @@
* ------------------------------------------------------------------------
*/
var Tooltip = /*#__PURE__*/function () {
function Tooltip(element, config) {
- if (typeof Popper === 'undefined') {
+ if (typeof Popper__default['default'] === 'undefined') {
throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org)');
} // private
this._isEnabled = true;
@@ -3481,15 +3463,15 @@
return;
}
if (event) {
var dataKey = this.constructor.DATA_KEY;
- var context = Data.getData(event.target, dataKey);
+ var context = Data.getData(event.delegateTarget, dataKey);
if (!context) {
- context = new this.constructor(event.target, this._getDelegateConfig());
- Data.setData(event.target, dataKey, context);
+ context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
+ Data.setData(event.delegateTarget, dataKey, context);
}
context._activeTrigger.click = !context._activeTrigger.click;
if (context._isWithActiveTrigger()) {
@@ -3572,11 +3554,11 @@
if (!this.element.ownerDocument.documentElement.contains(this.tip)) {
container.appendChild(tip);
}
EventHandler.trigger(this.element, this.constructor.Event.INSERTED);
- this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
+ this._popper = new Popper__default['default'](this.element, tip, this._getPopperConfig(attachment));
tip.classList.add(CLASS_NAME_SHOW$3); // If this is a touch-enabled device we add extra
// empty mouseover listeners to the body's immediate children;
// only needed because of broken event delegation on iOS
// https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
@@ -3613,10 +3595,14 @@
};
_proto.hide = function hide() {
var _this2 = this;
+ if (!this._popper) {
+ return;
+ }
+
var tip = this.getTipElement();
var complete = function complete() {
if (_this2._hoverState !== HOVER_STATE_SHOW && tip.parentNode) {
tip.parentNode.removeChild(tip);
@@ -3714,11 +3700,11 @@
return;
}
if (this.config.html) {
if (this.config.sanitize) {
- content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
+ content = sanitizeHtml(content, this.config.allowList, this.config.sanitizeFn);
}
element.innerHTML = content;
} else {
element.textContent = content;
@@ -3760,11 +3746,11 @@
},
onUpdate: function onUpdate(data) {
return _this3._handlePopperPlacementChange(data);
}
};
- return _objectSpread2(_objectSpread2({}, defaultBsConfig), this.config.popperConfig);
+ return _extends({}, defaultBsConfig, this.config.popperConfig);
};
_proto._addAttachmentClass = function _addAttachmentClass(attachment) {
this.getTipElement().classList.add(CLASS_PREFIX + "-" + attachment);
};
@@ -3774,11 +3760,11 @@
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;
}
@@ -3830,11 +3816,11 @@
};
EventHandler.on(this.element.closest("." + CLASS_NAME_MODAL), '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();
@@ -3850,15 +3836,15 @@
}
};
_proto._enter = function _enter(event, context) {
var dataKey = this.constructor.DATA_KEY;
- context = context || Data.getData(event.target, dataKey);
+ context = context || Data.getData(event.delegateTarget, dataKey);
if (!context) {
- context = new this.constructor(event.target, this._getDelegateConfig());
- Data.setData(event.target, dataKey, context);
+ context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
+ Data.setData(event.delegateTarget, dataKey, context);
}
if (event) {
context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
}
@@ -3883,15 +3869,15 @@
}, context.config.delay.show);
};
_proto._leave = function _leave(event, context) {
var dataKey = this.constructor.DATA_KEY;
- context = context || Data.getData(event.target, dataKey);
+ context = context || Data.getData(event.delegateTarget, dataKey);
if (!context) {
- context = new this.constructor(event.target, this._getDelegateConfig());
- Data.setData(event.target, dataKey, context);
+ context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
+ Data.setData(event.delegateTarget, dataKey, context);
}
if (event) {
context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = false;
}
@@ -3935,11 +3921,11 @@
if (config && typeof config.container === 'object' && config.container.jquery) {
config.container = config.container[0];
}
- 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
@@ -3955,11 +3941,11 @@
}
typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
if (config.sanitize) {
- config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
+ config.template = sanitizeHtml(config.template, config.allowList, config.sanitizeFn);
}
return config;
};
@@ -3989,12 +3975,11 @@
});
}
};
_proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
- var popperInstance = popperData.instance;
- this.tip = popperInstance.popper;
+ this.tip = popperData.instance.popper;
this._cleanTipClass();
this._addAttachmentClass(this._getAttachment(popperData.placement));
};
@@ -4109,24 +4094,24 @@
* Constants
* ------------------------------------------------------------------------
*/
var NAME$7 = 'popover';
- var VERSION$7 = '5.0.0-alpha1';
+ var VERSION$7 = '5.0.0-alpha2';
var DATA_KEY$7 = 'bs.popover';
var EVENT_KEY$7 = "." + DATA_KEY$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="popover-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 Event$2 = {
HIDE: "hide" + EVENT_KEY$7,
@@ -4175,16 +4160,16 @@
content = content.call(this.element);
}
this.setElementContent(SelectorEngine.findOne(SELECTOR_CONTENT, tip), content);
tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$4);
- };
+ } // Private
+ ;
_proto._addAttachmentClass = function _addAttachmentClass(attachment) {
this.getTipElement().classList.add(CLASS_PREFIX$1 + "-" + attachment);
- } // Private
- ;
+ };
_proto._getContent = function _getContent() {
return this.element.getAttribute('data-content') || this.config.content;
};
@@ -4297,11 +4282,11 @@
* Constants
* ------------------------------------------------------------------------
*/
var NAME$8 = 'scrollspy';
- var VERSION$8 = '5.0.0-alpha1';
+ var VERSION$8 = '5.0.0-alpha2';
var DATA_KEY$8 = 'bs.scrollspy';
var EVENT_KEY$8 = "." + DATA_KEY$8;
var DATA_API_KEY$6 = '.data-api';
var Default$6 = {
offset: 10,
@@ -4338,11 +4323,11 @@
var _this = this;
this._element = element;
this._scrollElement = element.tagName === 'BODY' ? window : element;
this._config = this._getConfig(config);
- this._selector = this._config.target + " " + SELECTOR_NAV_LINKS + "," + (this._config.target + " " + SELECTOR_LIST_ITEMS + ",") + (this._config.target + " ." + CLASS_NAME_DROPDOWN_ITEM);
+ this._selector = this._config.target + " " + SELECTOR_NAV_LINKS + ", " + this._config.target + " " + SELECTOR_LIST_ITEMS + ", " + this._config.target + " ." + CLASS_NAME_DROPDOWN_ITEM;
this._offsets = [];
this._targets = [];
this._activeTarget = null;
this._scrollHeight = 0;
EventHandler.on(this._scrollElement, EVENT_SCROLL, function (event) {
@@ -4368,17 +4353,13 @@
this._offsets = [];
this._targets = [];
this._scrollHeight = this._getScrollHeight();
var targets = SelectorEngine.find(this._selector);
targets.map(function (element) {
- var target;
var targetSelector = getSelectorFromElement(element);
+ var target = targetSelector ? SelectorEngine.findOne(targetSelector) : null;
- if (targetSelector) {
- target = SelectorEngine.findOne(targetSelector);
- }
-
if (target) {
var targetBCR = target.getBoundingClientRect();
if (targetBCR.width || targetBCR.height) {
return [Manipulator[offsetMethod](target).top + offsetBase, targetSelector];
@@ -4410,11 +4391,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' && isElement(config.target)) {
var id = config.target.id;
if (!id) {
@@ -4600,11 +4581,11 @@
* Constants
* ------------------------------------------------------------------------
*/
var NAME$9 = 'tab';
- var VERSION$9 = '5.0.0-alpha1';
+ var VERSION$9 = '5.0.0-alpha2';
var DATA_KEY$9 = 'bs.tab';
var EVENT_KEY$9 = "." + DATA_KEY$9;
var DATA_API_KEY$7 = '.data-api';
var EVENT_HIDE$3 = "hide" + EVENT_KEY$9;
var EVENT_HIDDEN$3 = "hidden" + EVENT_KEY$9;
@@ -4827,11 +4808,11 @@
* Constants
* ------------------------------------------------------------------------
*/
var NAME$a = 'toast';
- var VERSION$a = '5.0.0-alpha1';
+ var VERSION$a = '5.0.0-alpha2';
var DATA_KEY$a = 'bs.toast';
var EVENT_KEY$a = "." + DATA_KEY$a;
var EVENT_CLICK_DISMISS$1 = "click.dismiss" + EVENT_KEY$a;
var EVENT_HIDE$4 = "hide" + EVENT_KEY$a;
var EVENT_HIDDEN$4 = "hidden" + EVENT_KEY$a;
@@ -4847,11 +4828,11 @@
delay: 'number'
};
var Default$7 = {
animation: true,
autohide: true,
- delay: 500
+ delay: 5000
};
var SELECTOR_DATA_DISMISS$1 = '[data-dismiss="toast"]';
/**
* ------------------------------------------------------------------------
* Class Definition
@@ -4880,10 +4861,12 @@
if (showEvent.defaultPrevented) {
return;
}
+ this._clearTimeout();
+
if (this._config.animation) {
this._element.classList.add(CLASS_NAME_FADE$4);
}
var complete = function complete() {
@@ -4944,12 +4927,11 @@
complete();
}
};
_proto.dispose = function dispose() {
- clearTimeout(this._timeout);
- this._timeout = null;
+ this._clearTimeout();
if (this._element.classList.contains(CLASS_NAME_SHOW$6)) {
this._element.classList.remove(CLASS_NAME_SHOW$6);
}
@@ -4959,21 +4941,26 @@
this._config = null;
} // Private
;
_proto._getConfig = function _getConfig(config) {
- config = _objectSpread2(_objectSpread2(_objectSpread2({}, Default$7), Manipulator.getDataAttributes(this._element)), typeof config === 'object' && config ? config : {});
+ config = _extends({}, Default$7, Manipulator.getDataAttributes(this._element), typeof config === 'object' && config ? config : {});
typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
return config;
};
_proto._setListeners = function _setListeners() {
var _this3 = this;
EventHandler.on(this._element, EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, function () {
return _this3.hide();
});
+ };
+
+ _proto._clearTimeout = function _clearTimeout() {
+ clearTimeout(this._timeout);
+ this._timeout = null;
} // Static
;
Toast.jQueryInterface = function jQueryInterface(config) {
return this.each(function () {
@@ -5040,10 +5027,10 @@
};
}
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.0-alpha1): index.umd.js
+ * Bootstrap (v5.0.0-alpha2): index.umd.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
var index_umd = {
Alert: Alert,