Skip to content

Commit

Permalink
filter before foreach
Browse files Browse the repository at this point in the history
  • Loading branch information
Roiocam committed Jan 24, 2024
1 parent 9edb4db commit 3a3eeb8
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions theme/src/main/assets/assets/javascripts/groups.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,9 @@ $(function() {
$(".toc").each(function() {
var tocRoot = $(this);
function findHeaderElements(element) {
var headerElements = element.find(".header");
var headerElements = element.find(".header").filter("a");
headerElements.each(function() {
var headerElement = $(this);
// only work with the header link
if (!headerElement.is("a")) {
return false;
}
// if header hiding by group switch, hide they li parent
// otherwise display there li parent
if (headerElement.css("display") === "none" ) {
Expand All @@ -181,7 +177,7 @@ $(function() {
}

findHeaderElements(tocRoot);
})
})

groupChangeListeners.forEach(listener => listener(group, supergroup, catalog));
}
Expand Down

0 comments on commit 3a3eeb8

Please sign in to comment.