From: GeoSot Date: Fri, 10 Sep 2021 00:33:14 +0000 (+0300) Subject: Carousel: refactor dataApiKeyHandler to avoid use of `carouselInterface` X-Git-Tag: v5.2.0-beta1~193 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=631cec4f70fa74b066c9d949aa5b8bf8cf06b46d;p=thirdparty%2Fbootstrap.git Carousel: refactor dataApiKeyHandler to avoid use of `carouselInterface` --- diff --git a/js/src/carousel.js b/js/src/carousel.js index 7b22e9cbfe..a5fe2597b8 100644 --- a/js/src/carousel.js +++ b/js/src/carousel.js @@ -472,22 +472,22 @@ class Carousel extends BaseComponent { return } - const config = { - ...Manipulator.getDataAttributes(this) - } + event.preventDefault() + + const carousel = Carousel.getOrCreateInstance(target) const slideIndex = this.getAttribute('data-bs-slide-to') if (slideIndex) { - config.interval = false + carousel.to(slideIndex) + return } - Carousel.carouselInterface(target, config) - - if (slideIndex) { - Carousel.getInstance(target).to(slideIndex) + if (Manipulator.getDataAttribute(this, 'slide') === 'next') { + carousel.next() + return } - event.preventDefault() + carousel.prev() } }