@@ -94,9 +94,9 @@ class Navigation extends BaseComponent {
94
94
}
95
95
96
96
_setActiveLink ( ) {
97
- Array . from ( this . _element . querySelectorAll ( SELECTOR_NAV_LINK ) ) . forEach ( element => {
97
+ for ( const element of Array . from ( this . _element . querySelectorAll ( SELECTOR_NAV_LINK ) ) ) {
98
98
if ( element . classList . contains ( CLASS_NAME_NAV_GROUP_TOGGLE ) ) {
99
- return
99
+ continue
100
100
}
101
101
102
102
let currentUrl = String ( window . location )
@@ -115,6 +115,7 @@ class Navigation extends BaseComponent {
115
115
116
116
if ( this . _config . activeLinksExact && element . href === currentUrl ) {
117
117
element . classList . add ( CLASS_NAME_ACTIVE )
118
+ // eslint-disable-next-line unicorn/no-array-for-each
118
119
Array . from ( this . _getParents ( element , SELECTOR_NAV_GROUP ) ) . forEach ( element => {
119
120
element . classList . add ( CLASS_NAME_SHOW )
120
121
element . setAttribute ( 'aria-expanded' , true )
@@ -123,12 +124,13 @@ class Navigation extends BaseComponent {
123
124
124
125
if ( ! this . _config . activeLinksExact && element . href . startsWith ( currentUrl ) ) {
125
126
element . classList . add ( CLASS_NAME_ACTIVE )
127
+ // eslint-disable-next-line unicorn/no-array-for-each
126
128
Array . from ( this . _getParents ( element , SELECTOR_NAV_GROUP ) ) . forEach ( element => {
127
129
element . classList . add ( CLASS_NAME_SHOW )
128
130
element . setAttribute ( 'aria-expanded' , true )
129
131
} )
130
132
}
131
- } )
133
+ }
132
134
}
133
135
134
136
_getParents ( element , selector ) {
@@ -225,12 +227,12 @@ class Navigation extends BaseComponent {
225
227
226
228
// Close other groups
227
229
if ( this . _config . groupsAutoCollapse === true ) {
228
- this . _getSiblings ( toggler . parentNode , filter ) . forEach ( element => {
230
+ for ( const element of this . _getSiblings ( toggler . parentNode , filter ) ) {
229
231
this . _slideUp ( SelectorEngine . findOne ( SELECTOR_NAV_GROUP_ITEMS , element ) , ( ) => {
230
232
element . classList . remove ( CLASS_NAME_SHOW )
231
233
element . setAttribute ( 'aria-expanded' , false )
232
234
} )
233
- } )
235
+ }
234
236
}
235
237
236
238
if ( toggler . parentNode . classList . contains ( CLASS_NAME_SHOW ) ) {
@@ -280,9 +282,9 @@ class Navigation extends BaseComponent {
280
282
* ------------------------------------------------------------------------
281
283
*/
282
284
EventHandler . on ( window , EVENT_LOAD_DATA_API , ( ) => {
283
- Array . from ( document . querySelectorAll ( SELECTOR_DATA_NAVIGATION ) ) . forEach ( element => {
285
+ for ( const element of Array . from ( document . querySelectorAll ( SELECTOR_DATA_NAVIGATION ) ) ) {
284
286
Navigation . navigationInterface ( element )
285
- } )
287
+ }
286
288
} )
287
289
288
290
/**
0 commit comments