From e79c8f3489527d7f5eef2bb3cf14856f26c49871 Mon Sep 17 00:00:00 2001 From: Rohit Sharma Date: Mon, 18 Jan 2021 12:15:56 +0530 Subject: Just find the active indicator --- js/src/carousel.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'js/src/carousel.js') diff --git a/js/src/carousel.js b/js/src/carousel.js index 9fd8aae3db..2874e6e95d 100644 --- a/js/src/carousel.js +++ b/js/src/carousel.js @@ -406,12 +406,10 @@ class Carousel extends BaseComponent { _setActiveIndicatorElement(element) { if (this._indicatorsElement) { - const activeIndicators = SelectorEngine.find(SELECTOR_ACTIVE, this._indicatorsElement) + const activeIndicator = SelectorEngine.findOne(SELECTOR_ACTIVE, this._indicatorsElement) - for (let i = 0; i < activeIndicators.length; i++) { - activeIndicators[i].classList.remove(CLASS_NAME_ACTIVE) - activeIndicators[i].removeAttribute('aria-current') - } + activeIndicator.classList.remove(CLASS_NAME_ACTIVE) + activeIndicator.removeAttribute('aria-current') const indicators = SelectorEngine.find(SELECTOR_INDICATOR, this._indicatorsElement) -- cgit v1.2.3