We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0fcb7da commit fc61ccaCopy full SHA for fc61cca
src/librustdoc/html/static/main.js
@@ -306,6 +306,14 @@ function defocusSearchBar() {
306
function expandSection(id) {
307
var elem = document.getElementById(id);
308
if (elem && isHidden(elem)) {
309
+ if (elem.tagName === "CODE" && elem.parentNode.tagName === "H4") {
310
+ // We are in a trait implementation, what we want is the parent.
311
+ elem = elem.parentNode;
312
+ if (elem.id !== null && elem.id.length > 0) {
313
+ // Change the id to the parent which is "more clear" and better for users.
314
+ window.location.hash = elem.id;
315
+ }
316
317
var h3 = elem.parentNode.previousElementSibling;
318
if (h3 && h3.tagName !== "H3") {
319
h3 = h3.previousElementSibling; // skip div.docblock
0 commit comments