From 384eccbfaf3f234944f8d60ac70dd7966814c994 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Wed, 11 Nov 2020 19:07:37 +0200 Subject: Prepare v5.0.0-alpha3 (#32122) --- js/dist/carousel.js | 70 +++++++++++++++++++++++++++++++++++------------------ 1 file changed, 46 insertions(+), 24 deletions(-) (limited to 'js/dist/carousel.js') diff --git a/js/dist/carousel.js b/js/dist/carousel.js index dbd9f838ab..e608196d7f 100644 --- a/js/dist/carousel.js +++ b/js/dist/carousel.js @@ -1,5 +1,5 @@ /*! - * Bootstrap carousel.js v5.0.0-alpha2 (https://getbootstrap.com/) + * Bootstrap carousel.js v5.0.0-alpha3 (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) */ @@ -18,7 +18,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.0.0-alpha2): util/index.js + * Bootstrap (v5.0.0-alpha3): util/index.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -139,6 +139,14 @@ return null; }; + var onDOMContentLoaded = function onDOMContentLoaded(callback) { + if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', callback); + } else { + callback(); + } + }; + function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } @@ -151,7 +159,7 @@ */ var NAME = 'carousel'; - var VERSION = '5.0.0-alpha2'; + var VERSION = '5.0.0-alpha3'; var DATA_KEY = 'bs.carousel'; var EVENT_KEY = "." + DATA_KEY; var DATA_API_KEY = '.data-api'; @@ -289,6 +297,8 @@ } if (this._config && this._config.interval && !this._isPaused) { + this._updateInterval(); + this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval); } }; @@ -530,6 +540,23 @@ } }; + _proto._updateInterval = function _updateInterval() { + var element = this._activeElement || SelectorEngine__default['default'].findOne(SELECTOR_ACTIVE_ITEM, this._element); + + if (!element) { + return; + } + + var elementInterval = parseInt(element.getAttribute('data-interval'), 10); + + if (elementInterval) { + this._config.defaultInterval = this._config.defaultInterval || this._config.interval; + this._config.interval = elementInterval; + } else { + this._config.interval = this._config.defaultInterval || this._config.interval; + } + }; + _proto._slide = function _slide(direction, element) { var _this4 = this; @@ -580,20 +607,13 @@ this._setActiveIndicatorElement(nextElement); + this._activeElement = nextElement; + if (this._element.classList.contains(CLASS_NAME_SLIDE)) { nextElement.classList.add(orderClassName); reflow(nextElement); activeElement.classList.add(directionalClassName); nextElement.classList.add(directionalClassName); - var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10); - - if (nextElementInterval) { - this._config.defaultInterval = this._config.defaultInterval || this._config.interval; - this._config.interval = nextElementInterval; - } else { - this._config.interval = this._config.defaultInterval || this._config.interval; - } - var transitionDuration = getTransitionDurationFromElement(activeElement); EventHandler__default['default'].one(activeElement, TRANSITION_END, function () { nextElement.classList.remove(directionalClassName, orderClassName); @@ -720,26 +740,28 @@ Carousel.carouselInterface(carousels[i], Data__default['default'].getData(carousels[i], DATA_KEY)); } }); - var $ = getjQuery(); /** * ------------------------------------------------------------------------ * jQuery * ------------------------------------------------------------------------ - * add .carousel to jQuery only if jQuery is present + * add .Carousel to jQuery only if jQuery is present */ - /* istanbul ignore if */ + onDOMContentLoaded(function () { + var $ = getjQuery(); + /* istanbul ignore if */ - if ($) { - var JQUERY_NO_CONFLICT = $.fn[NAME]; - $.fn[NAME] = Carousel.jQueryInterface; - $.fn[NAME].Constructor = Carousel; + if ($) { + var JQUERY_NO_CONFLICT = $.fn[NAME]; + $.fn[NAME] = Carousel.jQueryInterface; + $.fn[NAME].Constructor = Carousel; - $.fn[NAME].noConflict = function () { - $.fn[NAME] = JQUERY_NO_CONFLICT; - return Carousel.jQueryInterface; - }; - } + $.fn[NAME].noConflict = function () { + $.fn[NAME] = JQUERY_NO_CONFLICT; + return Carousel.jQueryInterface; + }; + } + }); return Carousel; -- cgit v1.2.3