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/tab.js')
-rw-r--r--assets/javascripts/bootstrap/tab.js82
1 files changed, 14 insertions, 68 deletions
diff --git a/assets/javascripts/bootstrap/tab.js b/assets/javascripts/bootstrap/tab.js
index 1f22a48..933c793 100644
--- a/assets/javascripts/bootstrap/tab.js
+++ b/assets/javascripts/bootstrap/tab.js
@@ -1,30 +1,21 @@
/*!
- * Bootstrap tab.js v5.0.0 (https://getbootstrap.com/)
+ * Bootstrap tab.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('./dom/selector-engine.js'), require('./base-component.js')) :
- typeof define === 'function' && define.amd ? define(['./dom/data', './dom/event-handler', './dom/selector-engine', './base-component'], factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Tab = factory(global.Data, global.EventHandler, global.SelectorEngine, global.Base));
-}(this, (function (Data, EventHandler, SelectorEngine, 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.Tab = 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 }; }
+ var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
- var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
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');
@@ -54,51 +45,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 isDisabled = element => {
if (!element || element.nodeType !== Node.ELEMENT_NODE) {
return true;
@@ -137,12 +83,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;
@@ -157,7 +104,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.0): tab.js
+ * Bootstrap (v5.0.1): tab.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -195,8 +142,8 @@
class Tab extends BaseComponent__default['default'] {
// Getters
- static get DATA_KEY() {
- return DATA_KEY;
+ static get NAME() {
+ return NAME;
} // Public
@@ -254,10 +201,9 @@
const complete = () => this._transitionComplete(element, active, callback);
if (active && isTransitioning) {
- const transitionDuration = getTransitionDurationFromElement(active);
active.classList.remove(CLASS_NAME_SHOW);
- EventHandler__default['default'].one(active, 'transitionend', complete);
- emulateTransitionEnd(active, transitionDuration);
+
+ this._queueCallback(complete, element, true);
} else {
complete();
}
@@ -352,7 +298,7 @@
* add .Tab to jQuery only if jQuery is present
*/
- defineJQueryPlugin(NAME, Tab);
+ defineJQueryPlugin(Tab);
return Tab;