diff options
author | Mario <mario@mariovavti.com> | 2021-09-23 08:33:36 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2021-09-23 08:33:36 +0000 |
commit | a451449766d581978068a5b8f8c1e27f50386ea7 (patch) | |
tree | 17388d0d116d3c3a3e14745397b5b3278e933d74 /vendor/twbs/bootstrap/js/dist/alert.js | |
parent | 3347fab105a01f38800a907e7d6281d835a29f5c (diff) | |
download | volse-hubzilla-a451449766d581978068a5b8f8c1e27f50386ea7.tar.gz volse-hubzilla-a451449766d581978068a5b8f8c1e27f50386ea7.tar.bz2 volse-hubzilla-a451449766d581978068a5b8f8c1e27f50386ea7.zip |
Revert "composer update bootstrap to version 5.1.1"
This reverts commit 89e4006b2d84d398e34d407a019854823b1dd37d.
Diffstat (limited to 'vendor/twbs/bootstrap/js/dist/alert.js')
-rw-r--r-- | vendor/twbs/bootstrap/js/dist/alert.js | 116 |
1 files changed, 43 insertions, 73 deletions
diff --git a/vendor/twbs/bootstrap/js/dist/alert.js b/vendor/twbs/bootstrap/js/dist/alert.js index 6a6b2e7ba..5572ad9c3 100644 --- a/vendor/twbs/bootstrap/js/dist/alert.js +++ b/vendor/twbs/bootstrap/js/dist/alert.js @@ -1,26 +1,19 @@ /*! - * Bootstrap alert.js v5.1.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/event-handler.js'), require('./base-component.js')) : - typeof define === 'function' && define.amd ? define(['./dom/event-handler', './base-component'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Alert = factory(global.EventHandler, global.Base)); -}(this, (function (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 EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler); var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent); - /** - * -------------------------------------------------------------------------- - * Bootstrap (v5.1.1): util/index.js - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) - * -------------------------------------------------------------------------- - */ - const getSelector = element => { let selector = element.getAttribute('data-bs-target'); @@ -50,22 +43,6 @@ return selector ? document.querySelector(selector) : null; }; - const isDisabled = element => { - if (!element || element.nodeType !== Node.ELEMENT_NODE) { - return true; - } - - if (element.classList.contains('disabled')) { - return true; - } - - if (typeof element.disabled !== 'undefined') { - return element.disabled; - } - - return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false'; - }; - const getjQuery = () => { const { jQuery @@ -116,33 +93,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.1): util/component-functions.js - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) - * -------------------------------------------------------------------------- - */ - - const enableDismissTrigger = (component, method = 'hide') => { - const clickEvent = `click.dismiss${component.EVENT_KEY}`; - const name = component.NAME; - EventHandler__default['default'].on(document, clickEvent, `[data-bs-dismiss="${name}"]`, function (event) { - if (['A', 'AREA'].includes(this.tagName)) { - event.preventDefault(); - } - - if (isDisabled(this)) { - return; - } - - const target = getElementFromSelector(this) || this.closest(`.${name}`); - const instance = component.getOrCreateInstance(target); // Method argument is left, for Alert and only, as it doesn't implement the 'hide' method - - instance[method](); - }); - }; - - /** - * -------------------------------------------------------------------------- - * Bootstrap (v5.1.1): alert.js + * Bootstrap (v5.0.2): alert.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -155,8 +106,12 @@ const NAME = 'alert'; const DATA_KEY = 'bs.alert'; const EVENT_KEY = `.${DATA_KEY}`; + const DATA_API_KEY = '.data-api'; + const SELECTOR_DISMISS = '[data-bs-dismiss="alert"]'; const EVENT_CLOSE = `close${EVENT_KEY}`; const EVENT_CLOSED = `closed${EVENT_KEY}`; + const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`; + const CLASS_NAME_ALERT = 'alert'; const CLASS_NAME_FADE = 'fade'; const CLASS_NAME_SHOW = 'show'; /** @@ -172,26 +127,37 @@ } // Public - close() { - const closeEvent = EventHandler__default['default'].trigger(this._element, EVENT_CLOSE); + close(element) { + const rootElement = element ? this._getRootElement(element) : this._element; + + const customEvent = this._triggerCloseEvent(rootElement); - if (closeEvent.defaultPrevented) { + if (customEvent === null || customEvent.defaultPrevented) { return; } - this._element.classList.remove(CLASS_NAME_SHOW); + this._removeElement(rootElement); + } // Private - const isAnimated = this._element.classList.contains(CLASS_NAME_FADE); - this._queueCallback(() => this._destroyElement(), this._element, isAnimated); - } // Private + _getRootElement(element) { + return getElementFromSelector(element) || element.closest(`.${CLASS_NAME_ALERT}`); + } + _triggerCloseEvent(element) { + return EventHandler__default['default'].trigger(element, EVENT_CLOSE); + } - _destroyElement() { - this._element.remove(); + _removeElement(element) { + element.classList.remove(CLASS_NAME_SHOW); + const isAnimated = element.classList.contains(CLASS_NAME_FADE); - EventHandler__default['default'].trigger(this._element, EVENT_CLOSED); - this.dispose(); + this._queueCallback(() => this._destroyElement(element), element, isAnimated); + } + + _destroyElement(element) { + element.remove(); + EventHandler__default['default'].trigger(element, EVENT_CLOSED); } // Static @@ -199,16 +165,20 @@ return this.each(function () { const data = Alert.getOrCreateInstance(this); - if (typeof config !== 'string') { - return; + if (config === 'close') { + data[config](this); } + }); + } - if (data[config] === undefined || config.startsWith('_') || config === 'constructor') { - throw new TypeError(`No method named "${config}"`); + static handleDismiss(alertInstance) { + return function (event) { + if (event) { + event.preventDefault(); } - data[config](this); - }); + alertInstance.close(this); + }; } } @@ -219,7 +189,7 @@ */ - enableDismissTrigger(Alert, 'close'); + EventHandler__default['default'].on(document, EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert.handleDismiss(new Alert())); /** * ------------------------------------------------------------------------ * jQuery |