From 2b4d0d166b58cabfb0384a2081d84e51df84e37f Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Tue, 10 Aug 2021 18:07:39 +0300 Subject: Enable `unicorn/no-for-loop` rule --- js/src/carousel.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'js/src/carousel.js') diff --git a/js/src/carousel.js b/js/src/carousel.js index 96812d3b6..322ad46a0 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)) } }) -- cgit v1.2.3