rustdoc: fix buggy JS check for absolute URL
The old code did the wrong thing when faced with a crate named "http".
This commit is contained in:
parent
ab10908e8c
commit
49111eced6
11 changed files with 33 additions and 3 deletions
|
@ -563,7 +563,7 @@ function loadCss(cssUrl) {
|
|||
onEachLazy(code.getElementsByTagName("a"), elem => {
|
||||
const href = elem.getAttribute("href");
|
||||
|
||||
if (href && href.indexOf("http") !== 0) {
|
||||
if (href && !/^(?:[a-z+]+:)?\/\//.test(href)) {
|
||||
elem.setAttribute("href", window.rootPath + href);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue