Fix lines highlighting in rustdoc source view
This commit is contained in:
parent
589beb979c
commit
8ca3887439
1 changed files with 14 additions and 3 deletions
|
@ -162,8 +162,15 @@ if (!DOMTokenList.prototype.remove) {
|
||||||
var i, from, to, match = window.location.hash.match(/^#?(\d+)(?:-(\d+))?$/);
|
var i, from, to, match = window.location.hash.match(/^#?(\d+)(?:-(\d+))?$/);
|
||||||
if (match) {
|
if (match) {
|
||||||
from = parseInt(match[1], 10);
|
from = parseInt(match[1], 10);
|
||||||
to = Math.min(50000, parseInt(match[2] || match[1], 10));
|
to = from;
|
||||||
from = Math.min(from, to);
|
if (typeof match[2] !== "undefined") {
|
||||||
|
to = parseInt(match[2], 10);
|
||||||
|
}
|
||||||
|
if (to < from) {
|
||||||
|
var tmp = to;
|
||||||
|
to = from;
|
||||||
|
from = tmp;
|
||||||
|
}
|
||||||
elem = document.getElementById(from);
|
elem = document.getElementById(from);
|
||||||
if (!elem) {
|
if (!elem) {
|
||||||
return;
|
return;
|
||||||
|
@ -180,7 +187,11 @@ if (!DOMTokenList.prototype.remove) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
for (i = from; i <= to; ++i) {
|
for (i = from; i <= to; ++i) {
|
||||||
addClass(document.getElementById(i), "line-highlighted");
|
elem = document.getElementById(i);
|
||||||
|
if (!elem) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
addClass(elem, "line-highlighted");
|
||||||
}
|
}
|
||||||
} else if (ev !== null && search && !hasClass(search, "hidden") && ev.newURL) {
|
} else if (ev !== null && search && !hasClass(search, "hidden") && ev.newURL) {
|
||||||
addClass(search, "hidden");
|
addClass(search, "hidden");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue