aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/twbs/bootstrap/js/dist/alert.js
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/twbs/bootstrap/js/dist/alert.js')
-rw-r--r--vendor/twbs/bootstrap/js/dist/alert.js35
1 files changed, 18 insertions, 17 deletions
diff --git a/vendor/twbs/bootstrap/js/dist/alert.js b/vendor/twbs/bootstrap/js/dist/alert.js
index f130e4b9e..5572ad9c3 100644
--- a/vendor/twbs/bootstrap/js/dist/alert.js
+++ b/vendor/twbs/bootstrap/js/dist/alert.js
@@ -1,17 +1,16 @@
/*!
- * Bootstrap alert.js v5.0.1 (https://getbootstrap.com/)
+ * Bootstrap alert.js v5.0.2 (https://getbootstrap.com/)
* Copyright 2011-2021 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('./dom/selector-engine.js'), require('./dom/data.js'), require('./dom/event-handler.js'), require('./base-component.js')) :
- typeof define === 'function' && define.amd ? define(['./dom/selector-engine', './dom/data', './dom/event-handler', './base-component'], factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Alert = factory(global.SelectorEngine, global.Data, global.EventHandler, global.Base));
-}(this, (function (SelectorEngine, Data, EventHandler, BaseComponent) { 'use strict';
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/selector-engine.js'), require('./dom/event-handler.js'), require('./base-component.js')) :
+ typeof define === 'function' && define.amd ? define(['./dom/selector-engine', './dom/event-handler', './base-component'], factory) :
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Alert = factory(global.SelectorEngine, global.EventHandler, global.Base));
+}(this, (function (SelectorEngine, EventHandler, BaseComponent) { 'use strict';
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
- var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
@@ -56,9 +55,18 @@
return null;
};
+ const DOMContentLoadedCallbacks = [];
+
const onDOMContentLoaded = callback => {
if (document.readyState === 'loading') {
- document.addEventListener('DOMContentLoaded', callback);
+ // add listener on the first call when the document is in loading state
+ if (!DOMContentLoadedCallbacks.length) {
+ document.addEventListener('DOMContentLoaded', () => {
+ DOMContentLoadedCallbacks.forEach(callback => callback());
+ });
+ }
+
+ DOMContentLoadedCallbacks.push(callback);
} else {
callback();
}
@@ -85,7 +93,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.1): alert.js
+ * Bootstrap (v5.0.2): alert.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -148,21 +156,14 @@
}
_destroyElement(element) {
- if (element.parentNode) {
- element.parentNode.removeChild(element);
- }
-
+ element.remove();
EventHandler__default['default'].trigger(element, EVENT_CLOSED);
} // Static
static jQueryInterface(config) {
return this.each(function () {
- let data = Data__default['default'].get(this, DATA_KEY);
-
- if (!data) {
- data = new Alert(this);
- }
+ const data = Alert.getOrCreateInstance(this);
if (config === 'close') {
data[config](this);