Skip to content

Commit 42c1133

Browse files
Rollup merge of rust-lang#58336 - GuillaumeGomez:fix-search-results-interactions, r=oli-obk
Fix search results interactions The bug is visible when you search for "none": the second tab is empty and therefore it messes with the classes. Then when you try to use arrows on the third tab, it just crashes (because only 2 "search-results" are present and you're on tab 3). r? @QuietMisdreavus
2 parents ce9b9f8 + 69d948d commit 42c1133

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/librustdoc/html/static/main.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1196,7 +1196,7 @@ if (!DOMTokenList.prototype.remove) {
11961196
var actives = [[], [], []];
11971197
// "current" is used to know which tab we're looking into.
11981198
var current = 0;
1199-
onEachLazy(document.getElementsByClassName("search-results"), function(e) {
1199+
onEachLazy(document.getElementById("results").childNodes, function(e) {
12001200
onEachLazy(e.getElementsByClassName("highlighted"), function(e) {
12011201
actives[current].push(e);
12021202
});
@@ -1213,7 +1213,7 @@ if (!DOMTokenList.prototype.remove) {
12131213
removeClass(actives[currentTab][0], "highlighted");
12141214
} else if (e.which === 40) { // down
12151215
if (!actives[currentTab].length) {
1216-
var results = document.getElementsByClassName("search-results");
1216+
var results = document.getElementById("results").childNodes;
12171217
if (results.length > 0) {
12181218
var res = results[currentTab].getElementsByClassName("result");
12191219
if (res.length > 0) {

0 commit comments

Comments
 (0)