Skip to content

Commit 3821ab2

Browse files
authored
Rollup merge of rust-lang#90571 - GuillaumeGomez:missing-bottom-border-sidebar, r=jsha
Fix missing bottom border for headings in sidebar Fixes rust-lang#90568. r? ```@jsha```
2 parents 1aa8c01 + aa17e1c commit 3821ab2

File tree

4 files changed

+26
-17
lines changed

4 files changed

+26
-17
lines changed

src/librustdoc/html/static/css/rustdoc.css

+2-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ h1.fqn > .in-band > a:hover {
156156
section hierarchies. */
157157
h2,
158158
.top-doc h3,
159-
.top-doc h4 {
159+
.top-doc h4,
160+
.sidebar .others h3 {
160161
border-bottom: 1px solid;
161162
}
162163
h3.code-header {

src/librustdoc/html/static/js/main.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,7 @@ function hideThemeButtonState() {
566566
// delayed sidebar rendering.
567567
window.initSidebarItems = function(items) {
568568
var sidebar = document.getElementsByClassName("sidebar-elems")[0];
569+
var others;
569570
var current = window.sidebarCurrent;
570571

571572
function addSidebarCrates(crates) {
@@ -594,7 +595,7 @@ function hideThemeButtonState() {
594595
li.appendChild(link);
595596
ul.appendChild(li);
596597
}
597-
sidebar.appendChild(div);
598+
others.appendChild(div);
598599
}
599600

600601
function block(shortty, longty) {
@@ -635,10 +636,14 @@ function hideThemeButtonState() {
635636
ul.appendChild(li);
636637
}
637638
div.appendChild(ul);
638-
sidebar.appendChild(div);
639+
others.appendChild(div);
639640
}
640641

641642
if (sidebar) {
643+
others = document.createElement("div");
644+
others.className = "others";
645+
sidebar.appendChild(others);
646+
642647
var isModule = hasClass(document.body, "mod");
643648
if (!isModule) {
644649
block("primitive", "Primitive Types");

src/test/rustdoc-gui/headings.goml

+3
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ assert-css: ("h6#sub-heading-for-enum-impl-item-doc", {"border-bottom-width": "0
109109
assert-css: ("h6#sub-sub-heading-for-enum-impl-item-doc", {"font-size": "15.2px"})
110110
assert-css: ("h6#sub-sub-heading-for-enum-impl-item-doc", {"border-bottom-width": "0px"})
111111

112+
assert-text: (".sidebar .others h3", "Modules")
113+
assert-css: (".sidebar .others h3", {"border-bottom-width": "1px"}, ALL)
114+
112115
goto: file://|DOC_PATH|/test_docs/union.HeavilyDocumentedUnion.html
113116

114117
assert-css: ("h1.fqn", {"font-size": "24px"})

src/test/rustdoc-gui/sidebar.goml

+14-14
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ assert-text: (".sidebar > .location", "Crate test_docs")
44
assert-count: (".sidebar .location", 1)
55
assert-text: (".sidebar-elems > #all-types", "See all test_docs's items")
66
// We check that we have the crates list and that the "current" on is "test_docs".
7-
assert-text: (".sidebar-elems > .crate > ul > li > a.current", "test_docs")
7+
assert-text: (".sidebar-elems .crate > ul > li > a.current", "test_docs")
88
// And we're also supposed to have the list of items in the current module.
9-
assert-text: (".sidebar-elems > .items > ul > li:nth-child(1)", "Modules")
10-
assert-text: (".sidebar-elems > .items > ul > li:nth-child(2)", "Macros")
11-
assert-text: (".sidebar-elems > .items > ul > li:nth-child(3)", "Structs")
12-
assert-text: (".sidebar-elems > .items > ul > li:nth-child(4)", "Enums")
13-
assert-text: (".sidebar-elems > .items > ul > li:nth-child(5)", "Traits")
14-
assert-text: (".sidebar-elems > .items > ul > li:nth-child(6)", "Functions")
15-
assert-text: (".sidebar-elems > .items > ul > li:nth-child(7)", "Type Definitions")
16-
assert-text: (".sidebar-elems > .items > ul > li:nth-child(8)", "Unions")
17-
assert-text: (".sidebar-elems > .items > ul > li:nth-child(9)", "Keywords")
9+
assert-text: (".sidebar-elems .items > ul > li:nth-child(1)", "Modules")
10+
assert-text: (".sidebar-elems .items > ul > li:nth-child(2)", "Macros")
11+
assert-text: (".sidebar-elems .items > ul > li:nth-child(3)", "Structs")
12+
assert-text: (".sidebar-elems .items > ul > li:nth-child(4)", "Enums")
13+
assert-text: (".sidebar-elems .items > ul > li:nth-child(5)", "Traits")
14+
assert-text: (".sidebar-elems .items > ul > li:nth-child(6)", "Functions")
15+
assert-text: (".sidebar-elems .items > ul > li:nth-child(7)", "Type Definitions")
16+
assert-text: (".sidebar-elems .items > ul > li:nth-child(8)", "Unions")
17+
assert-text: (".sidebar-elems .items > ul > li:nth-child(9)", "Keywords")
1818
assert-text: ("#structs + .item-table .item-left > a", "Foo")
1919
click: "#structs + .item-table .item-left > a"
2020

@@ -24,13 +24,13 @@ assert-count: (".sidebar .location", 2)
2424
assert-false: ".sidebar-elems > .crate"
2525
// We now go back to the crate page to click on the "lib2" crate link.
2626
goto: file://|DOC_PATH|/test_docs/index.html
27-
click: ".sidebar-elems > .crate > ul > li:first-child > a"
27+
click: ".sidebar-elems .crate > ul > li:first-child > a"
2828

2929
// PAGE: lib2/index.html
3030
goto: file://|DOC_PATH|/lib2/index.html
3131
assert-text: (".sidebar > .location", "Crate lib2")
3232
// We check that we have the crates list and that the "current" on is now "lib2".
33-
assert-text: (".sidebar-elems > .crate > ul > li > a.current", "lib2")
33+
assert-text: (".sidebar-elems .crate > ul > li > a.current", "lib2")
3434
// We now go to the "foobar" function page.
3535
assert-text: (".sidebar-elems > .items > ul > li:nth-child(1)", "Modules")
3636
assert-text: (".sidebar-elems > .items > ul > li:nth-child(2)", "Structs")
@@ -57,6 +57,6 @@ assert-false: ".sidebar-elems > .crate"
5757
goto: ./sub_module/sub_sub_module/index.html
5858
assert-text: (".sidebar > .location", "Module sub_sub_module")
5959
// We check that we don't have the crate list.
60-
assert-false: ".sidebar-elems > .crate"
61-
assert-text: (".sidebar-elems > .items > ul > li:nth-child(1)", "Functions")
60+
assert-false: ".sidebar-elems .crate"
61+
assert-text: (".sidebar-elems .items > ul > li:nth-child(1)", "Functions")
6262
assert-text: ("#functions + .item-table .item-left > a", "foo")

0 commit comments

Comments
 (0)