File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -168,13 +168,11 @@ export default Base.extend({
168168 new URL ( nav_item . getAttribute ( "href" , "" ) , current_url ) ?. href
169169 ) ;
170170
171- const wrapper = this . options . itemWrapper
172- ? nav_item . closest ( this . options . itemWrapper )
173- : nav_item . parentNode ;
171+ const wrapper = nav_item . closest ( this . options . itemWrapper ) ;
174172
175173 if ( nav_url === current_url_prepared ) {
176174 nav_item . classList . add ( this . options . currentClass ) ;
177- wrapper . classList . add ( this . options . currentClass ) ;
175+ wrapper ? .classList . add ( this . options . currentClass ) ;
178176 this . mark_in_path ( nav_item ) ;
179177 } else if (
180178 // Compare the current navigation item url with a slash at the
@@ -185,7 +183,7 @@ export default Base.extend({
185183 nav_url !== portal_url
186184 ) {
187185 nav_item . classList . add ( this . options . inPathClass ) ;
188- wrapper . classList . add ( this . options . inPathClass ) ;
186+ wrapper ? .classList . add ( this . options . inPathClass ) ;
189187 } else {
190188 // Not even in path.
191189 continue ;
You can’t perform that action at this time.
0 commit comments