mirror of https://github.com/rust-lang/rust.git
rustdoc: wait for section to open before trying to highlight
This fixes a problem where hash rewriting doesn't work with `:target` CSS rules.
This commit is contained in:
parent
3583e86674
commit
20b93b951a
|
@ -370,8 +370,12 @@ function preLoadCss(cssUrl) {
|
|||
item => {
|
||||
const numbered = /([^-]+)-([0-9]+)/.exec(item.id);
|
||||
if (item.id === assocId || (numbered && numbered[1] === assocId)) {
|
||||
expandSection(item.id);
|
||||
window.location = "#" + item.id;
|
||||
openParentDetails(item);
|
||||
item.scrollIntoView();
|
||||
// Let the section expand itself before trying to highlight
|
||||
setTimeout(() => {
|
||||
window.location.replace("#" + item.id);
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
|
@ -20,6 +20,7 @@ wait-for: "#impl-ZyxwvutMethodDisambiguation"
|
|||
assert-document-property: ({
|
||||
"URL": "struct.ZyxwvutMethodDisambiguation.html#method.method_impl_disambiguation"
|
||||
}, ENDS_WITH)
|
||||
assert: "section:target"
|
||||
|
||||
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
|
||||
|
||||
|
@ -39,3 +40,4 @@ wait-for: "#impl-ZyxwvutMethodDisambiguation"
|
|||
assert-document-property: ({
|
||||
"URL": "struct.ZyxwvutMethodDisambiguation.html#method.method_impl_disambiguation-1"
|
||||
}, ENDS_WITH)
|
||||
assert: "section:target"
|
||||
|
|
Loading…
Reference in New Issue