Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap-rubygem.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'assets/javascripts/bootstrap/alert.js')
-rw-r--r--assets/javascripts/bootstrap/alert.js86
1 files changed, 13 insertions, 73 deletions
diff --git a/assets/javascripts/bootstrap/alert.js b/assets/javascripts/bootstrap/alert.js
index 031750d..1020f6d 100644
--- a/assets/javascripts/bootstrap/alert.js
+++ b/assets/javascripts/bootstrap/alert.js
@@ -1,13 +1,13 @@
/*!
- * Bootstrap alert.js v5.0.0 (https://getbootstrap.com/)
+ * Bootstrap alert.js v5.0.1 (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/data.js'), require('./dom/event-handler.js'), require('./base-component.js')) :
- typeof define === 'function' && define.amd ? define(['./dom/data', './dom/event-handler', './base-component'], factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Alert = factory(global.Data, global.EventHandler, global.Base));
-}(this, (function (Data, EventHandler, BaseComponent) { 'use strict';
+ 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';
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -15,15 +15,6 @@
var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
- /**
- * --------------------------------------------------------------------------
- * Bootstrap (v5.0.0): util/index.js
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
- * --------------------------------------------------------------------------
- */
- const MILLISECONDS_MULTIPLIER = 1000;
- const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
-
const getSelector = element => {
let selector = element.getAttribute('data-bs-target');
@@ -53,51 +44,6 @@
return selector ? document.querySelector(selector) : null;
};
- const getTransitionDurationFromElement = element => {
- if (!element) {
- return 0;
- } // Get transition-duration of the element
-
-
- let {
- transitionDuration,
- transitionDelay
- } = window.getComputedStyle(element);
- const floatTransitionDuration = Number.parseFloat(transitionDuration);
- const floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
-
- if (!floatTransitionDuration && !floatTransitionDelay) {
- return 0;
- } // If multiple durations are defined, take the first
-
-
- transitionDuration = transitionDuration.split(',')[0];
- transitionDelay = transitionDelay.split(',')[0];
- return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
- };
-
- const triggerTransitionEnd = element => {
- element.dispatchEvent(new Event(TRANSITION_END));
- };
-
- const emulateTransitionEnd = (element, duration) => {
- let called = false;
- const durationPadding = 5;
- const emulatedDuration = duration + durationPadding;
-
- function listener() {
- called = true;
- element.removeEventListener(TRANSITION_END, listener);
- }
-
- element.addEventListener(TRANSITION_END, listener);
- setTimeout(() => {
- if (!called) {
- triggerTransitionEnd(element);
- }
- }, emulatedDuration);
- };
-
const getjQuery = () => {
const {
jQuery
@@ -118,12 +64,13 @@
}
};
- const defineJQueryPlugin = (name, plugin) => {
+ const defineJQueryPlugin = plugin => {
onDOMContentLoaded(() => {
const $ = getjQuery();
/* istanbul ignore if */
if ($) {
+ const name = plugin.NAME;
const JQUERY_NO_CONFLICT = $.fn[name];
$.fn[name] = plugin.jQueryInterface;
$.fn[name].Constructor = plugin;
@@ -138,7 +85,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.0): alert.js
+ * Bootstrap (v5.0.1): alert.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -167,8 +114,8 @@
class Alert extends BaseComponent__default['default'] {
// Getters
- static get DATA_KEY() {
- return DATA_KEY;
+ static get NAME() {
+ return NAME;
} // Public
@@ -195,16 +142,9 @@
_removeElement(element) {
element.classList.remove(CLASS_NAME_SHOW);
+ const isAnimated = element.classList.contains(CLASS_NAME_FADE);
- if (!element.classList.contains(CLASS_NAME_FADE)) {
- this._destroyElement(element);
-
- return;
- }
-
- const transitionDuration = getTransitionDurationFromElement(element);
- EventHandler__default['default'].one(element, 'transitionend', () => this._destroyElement(element));
- emulateTransitionEnd(element, transitionDuration);
+ this._queueCallback(() => this._destroyElement(element), element, isAnimated);
}
_destroyElement(element) {
@@ -256,7 +196,7 @@
* add .Alert to jQuery only if jQuery is present
*/
- defineJQueryPlugin(NAME, Alert);
+ defineJQueryPlugin(Alert);
return Alert;