Skip to content

Commit

Permalink
rustdoc: Fix implementors list javascript
Browse files Browse the repository at this point in the history
* Use a different loop variable, `i` was already taken. This caused
missing items in the implementors list.
* Use `.getAttribute('href')` rather than `.href` to get the relative
URL which is what it needs to actually fix the links.
  • Loading branch information
ollie27 committed May 19, 2017
1 parent 9f15631 commit e48086c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/librustdoc/html/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1083,10 +1083,10 @@
code.innerHTML = structs[j];

var x = code.getElementsByTagName('a');
for (var i = 0; i < x.length; i++) {
var href = x[i].href;
for (var k = 0; k < x.length; k++) {
var href = x[k].getAttribute('href');
if (href && href.indexOf('http') !== 0) {
x[i].href = rootPath + href;
x[k].setAttribute('href', rootPath + href);
}
}
var li = document.createElement('li');
Expand Down

0 comments on commit e48086c

Please sign in to comment.