Skip to content

Commit be40c85

Browse files
rohit2sharma95XhmikosR
authored andcommitted
Just find the active indicator
1 parent f3de29f commit be40c85

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

js/src/carousel.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -406,12 +406,10 @@ class Carousel extends BaseComponent {
406406

407407
_setActiveIndicatorElement(element) {
408408
if (this._indicatorsElement) {
409-
const activeIndicators = SelectorEngine.find(SELECTOR_ACTIVE, this._indicatorsElement)
409+
const activeIndicator = SelectorEngine.findOne(SELECTOR_ACTIVE, this._indicatorsElement)
410410

411-
for (let i = 0; i < activeIndicators.length; i++) {
412-
activeIndicators[i].classList.remove(CLASS_NAME_ACTIVE)
413-
activeIndicators[i].removeAttribute('aria-current')
414-
}
411+
activeIndicator.classList.remove(CLASS_NAME_ACTIVE)
412+
activeIndicator.removeAttribute('aria-current')
415413

416414
const indicators = SelectorEngine.find(SELECTOR_INDICATOR, this._indicatorsElement)
417415

0 commit comments

Comments
 (0)