We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 58557fa commit acd5e8cCopy full SHA for acd5e8c
src/librustdoc/html/static/main.js
@@ -122,6 +122,7 @@
122
}
123
124
function highlightSourceLines(ev) {
125
+ var search = document.getElementById("search");
126
var i, from, to, match = window.location.hash.match(/^#?(\d+)(?:-(\d+))?$/);
127
if (match) {
128
from = parseInt(match[1], 10);
@@ -145,6 +146,14 @@
145
146
for (i = from; i <= to; ++i) {
147
addClass(document.getElementById(i), 'line-highlighted');
148
149
+ } else if (ev !== null && search && !hasClass(search, "hidden") && ev.newURL) {
150
+ addClass(search, "hidden");
151
+ removeClass(document.getElementById("main"), "hidden");
152
+ var hash = ev.newURL.slice(ev.newURL.indexOf('#') + 1);
153
+ var elem = document.getElementById(hash);
154
+ if (elem) {
155
+ elem.scrollIntoView();
156
+ }
157
158
159
highlightSourceLines(null);
0 commit comments