mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 19:58:32 +00:00
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 => {
|
item => {
|
||||||
const numbered = /([^-]+)-([0-9]+)/.exec(item.id);
|
const numbered = /([^-]+)-([0-9]+)/.exec(item.id);
|
||||||
if (item.id === assocId || (numbered && numbered[1] === assocId)) {
|
if (item.id === assocId || (numbered && numbered[1] === assocId)) {
|
||||||
expandSection(item.id);
|
openParentDetails(item);
|
||||||
window.location = "#" + item.id;
|
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: ({
|
assert-document-property: ({
|
||||||
"URL": "struct.ZyxwvutMethodDisambiguation.html#method.method_impl_disambiguation"
|
"URL": "struct.ZyxwvutMethodDisambiguation.html#method.method_impl_disambiguation"
|
||||||
}, ENDS_WITH)
|
}, ENDS_WITH)
|
||||||
|
assert: "section:target"
|
||||||
|
|
||||||
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
|
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
|
||||||
|
|
||||||
@ -39,3 +40,4 @@ wait-for: "#impl-ZyxwvutMethodDisambiguation"
|
|||||||
assert-document-property: ({
|
assert-document-property: ({
|
||||||
"URL": "struct.ZyxwvutMethodDisambiguation.html#method.method_impl_disambiguation-1"
|
"URL": "struct.ZyxwvutMethodDisambiguation.html#method.method_impl_disambiguation-1"
|
||||||
}, ENDS_WITH)
|
}, ENDS_WITH)
|
||||||
|
assert: "section:target"
|
||||||
|
Loading…
Reference in New Issue
Block a user