Skip to content

Commit 7106826

Browse files
committed
custom.js/search: Fix how parents are moved from title to category
1 parent 2145f26 commit 7106826

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/js/custom.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,11 @@ $(document).ready(function() {
153153
const category = $(element).find('.algolia-docsearch-suggestion--subcategory-column-text');
154154
category.append(separatorHtml);
155155
if (title.find('.' + separatorClass).length) {
156-
$.each(title.contents(), (i, e) => {
157-
if (title.contents().length > 1) {
158-
$(e).appendTo(category);
159-
}
160-
});
156+
const titleParts = title.html().split(separatorHtml);
157+
for (let i = 0; i < titleParts.length-2; i++) {
158+
$(titleParts[i]).appendTo(category);
159+
}
160+
title.html(titleParts[titleParts.length-1]);
161161
}
162162
if (separatorText != category.text().trim().slice(-1)) {
163163
category.append(separatorHtml);

0 commit comments

Comments
 (0)