diff options
| author | kennytm <kennytm@gmail.com> | 2019-02-20 01:13:16 +0800 |
|---|---|---|
| committer | kennytm <kennytm@gmail.com> | 2019-02-20 11:58:16 +0800 |
| commit | d22bb1a8b4402e19e35f038255883dcdb67376f0 (patch) | |
| tree | 0411f58b3901ee30c048e4343cd0185fac467704 | |
| parent | 120e9cb70f6411e56dc9e0ac38b8854f49c5233e (diff) | |
| parent | 69d948d3477c208e4954d603f20d87782c7ea401 (diff) | |
| download | rust-d22bb1a8b4402e19e35f038255883dcdb67376f0.tar.gz rust-d22bb1a8b4402e19e35f038255883dcdb67376f0.zip | |
Rollup merge of #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
| -rw-r--r-- | src/librustdoc/html/static/main.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index ff28c4f40bc..1849e53d937 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -1196,7 +1196,7 @@ if (!DOMTokenList.prototype.remove) { var actives = [[], [], []]; // "current" is used to know which tab we're looking into. var current = 0; - onEachLazy(document.getElementsByClassName("search-results"), function(e) { + onEachLazy(document.getElementById("results").childNodes, function(e) { onEachLazy(e.getElementsByClassName("highlighted"), function(e) { actives[current].push(e); }); @@ -1213,7 +1213,7 @@ if (!DOMTokenList.prototype.remove) { removeClass(actives[currentTab][0], "highlighted"); } else if (e.which === 40) { // down if (!actives[currentTab].length) { - var results = document.getElementsByClassName("search-results"); + var results = document.getElementById("results").childNodes; if (results.length > 0) { var res = results[currentTab].getElementsByClassName("result"); if (res.length > 0) { |
