diff options
Diffstat (limited to 'js/src/carousel.js')
-rw-r--r-- | js/src/carousel.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/js/src/carousel.js b/js/src/carousel.js index 96812d3b6a..322ad46a09 100644 --- a/js/src/carousel.js +++ b/js/src/carousel.js @@ -366,10 +366,10 @@ class Carousel extends BaseComponent { const indicators = SelectorEngine.find(SELECTOR_INDICATOR, this._indicatorsElement) - for (let i = 0; i < indicators.length; i++) { - if (Number.parseInt(indicators[i].getAttribute('data-bs-slide-to'), 10) === this._getItemIndex(element)) { - indicators[i].classList.add(CLASS_NAME_ACTIVE) - indicators[i].setAttribute('aria-current', 'true') + for (const indicator of indicators) { + if (Number.parseInt(indicator.getAttribute('data-bs-slide-to'), 10) === this._getItemIndex(element)) { + indicator.classList.add(CLASS_NAME_ACTIVE) + indicator.setAttribute('aria-current', 'true') break } } @@ -574,8 +574,8 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_SLIDE, Carousel.da EventHandler.on(window, EVENT_LOAD_DATA_API, () => { const carousels = SelectorEngine.find(SELECTOR_DATA_RIDE) - for (let i = 0, len = carousels.length; i < len; i++) { - Carousel.carouselInterface(carousels[i], Carousel.getInstance(carousels[i])) + for (const carousel of carousels) { + Carousel.carouselInterface(carousel, Carousel.getInstance(carousel)) } }) |