Skip to content

Commit b3865d1

Browse files
Remove more CSS classes
1 parent 3c62ccd commit b3865d1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+146
-162
lines changed

src/librustdoc/html/render/print_item.rs

+8-17
Original file line numberDiff line numberDiff line change
@@ -412,14 +412,14 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
412412
match *src {
413413
Some(src) => write!(
414414
w,
415-
"<dt class=\"item-name\"><code>{}extern crate {} as {};",
415+
"<dt><code>{}extern crate {} as {};",
416416
visibility_print_with_space(myitem, cx),
417417
anchor(myitem.item_id.expect_def_id(), src, cx),
418418
EscapeBodyTextWithWbr(myitem.name.unwrap().as_str()),
419419
),
420420
None => write!(
421421
w,
422-
"<dt class=\"item-name\"><code>{}extern crate {};",
422+
"<dt><code>{}extern crate {};",
423423
visibility_print_with_space(myitem, cx),
424424
anchor(myitem.item_id.expect_def_id(), myitem.name.unwrap(), cx),
425425
),
@@ -438,17 +438,11 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
438438
}
439439
clean::ImportKind::Glob => String::new(),
440440
};
441-
let (stab_tags_before, stab_tags_after) = if stab_tags.is_empty() {
442-
("", "")
443-
} else {
444-
("<dd class=\"desc docblock-short\">", "</dd>")
445-
};
446441
write!(
447442
w,
448-
"<dt class=\"item-name\"{id}>\
449-
<code>{vis}{imp}</code>\
450-
</dt>\
451-
{stab_tags_before}{stab_tags}{stab_tags_after}",
443+
"<dt{id}>\
444+
<code>{vis}{imp}</code>{stab_tags}\
445+
</dt>",
452446
vis = visibility_print_with_space(myitem, cx),
453447
imp = import.print(cx),
454448
);
@@ -486,14 +480,11 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
486480

487481
let docs =
488482
MarkdownSummaryLine(&myitem.doc_value(), &myitem.links(cx)).into_string();
489-
let (docs_before, docs_after) = if docs.is_empty() {
490-
("", "")
491-
} else {
492-
("<dd class=\"desc docblock-short\">", "</dd>")
493-
};
483+
let (docs_before, docs_after) =
484+
if docs.is_empty() { ("", "") } else { ("<dd>", "</dd>") };
494485
write!(
495486
w,
496-
"<dt class=\"item-name\">\
487+
"<dt>\
497488
<a class=\"{class}\" href=\"{href}\" title=\"{title}\">{name}</a>\
498489
{visibility_and_hidden}\
499490
{unsafety_flag}\

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

+11-11
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ h1, h2, h3, h4, h5, h6,
242242
.mobile-topbar,
243243
.search-input,
244244
.search-results .result-name,
245-
.item-name > a,
245+
.item-table dt > a,
246246
.out-of-band,
247247
.sub-heading,
248248
span.since,
@@ -385,11 +385,11 @@ details:not(.toggle) summary {
385385
code, pre, .code-header, .type-signature {
386386
font-family: "Source Code Pro", monospace;
387387
}
388-
.docblock code, .docblock-short code {
388+
.docblock code, .item-table dd code {
389389
border-radius: 3px;
390390
padding: 0 0.125em;
391391
}
392-
.docblock pre code, .docblock-short pre code {
392+
.docblock pre code, .item-table dd pre code {
393393
padding: 0;
394394
}
395395
pre {
@@ -887,13 +887,13 @@ both the code example and the line numbers, so we need to remove the radius in t
887887
text-align: center;
888888
}
889889

890-
.docblock-short {
890+
.item-table dd {
891891
overflow-wrap: break-word;
892892
overflow-wrap: anywhere;
893893
}
894894
/* Wrap non-pre code blocks (`text`) but not (```text```). */
895895
.docblock :not(pre) > code,
896-
.docblock-short code {
896+
.item-table dd code {
897897
white-space: pre-wrap;
898898
}
899899

@@ -938,7 +938,7 @@ rustdoc-toolbar {
938938
min-height: 60px;
939939
}
940940

941-
.docblock code, .docblock-short code,
941+
.docblock code, .item-table dd code,
942942
pre, .rustdoc.src .example-wrap, .example-wrap .src-line-numbers {
943943
background-color: var(--code-block-background-color);
944944
border-radius: var(--code-block-border-radius);
@@ -964,7 +964,7 @@ pre, .rustdoc.src .example-wrap, .example-wrap .src-line-numbers {
964964
background: var(--table-alt-row-background-color);
965965
}
966966

967-
.docblock .stab, .docblock-short .stab, .docblock p code {
967+
.docblock .stab, .item-table dd .stab, .docblock p code {
968968
display: inline-block;
969969
}
970970

@@ -1069,7 +1069,7 @@ because of the `[-]` element which would overlap with it. */
10691069
.example-wrap .rust a:hover,
10701070
.all-items a:hover,
10711071
.docblock a:not(.scrape-help):not(.tooltip):hover:not(.doc-anchor),
1072-
.docblock-short a:not(.scrape-help):not(.tooltip):hover,
1072+
.item-table dd a:not(.scrape-help):not(.tooltip):hover,
10731073
.item-info a {
10741074
text-decoration: underline;
10751075
}
@@ -1106,7 +1106,7 @@ table,
11061106
margin: 0;
11071107
width: 100%;
11081108
}
1109-
.item-table > .item-name {
1109+
.item-table > dt {
11101110
padding-right: 1.25rem;
11111111
}
11121112
.item-table > dd {
@@ -1412,7 +1412,7 @@ so that we can apply CSS-filters to change the arrow color in themes */
14121412
padding: 3px;
14131413
margin-bottom: 5px;
14141414
}
1415-
.item-name .stab {
1415+
.item-table dt .stab {
14161416
margin-left: 0.3125em;
14171417
}
14181418
.stab {
@@ -2481,7 +2481,7 @@ in src-script.js and main.js
24812481
.search-results > a {
24822482
padding: 5px 0px;
24832483
}
2484-
.search-results > a > div.desc, .item-table dd.desc {
2484+
.search-results > a > div.desc, .item-table dd {
24852485
padding-left: 2em;
24862486
}
24872487
.search-results .result-name {

tests/rustdoc-gui/item-name-wrap.goml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ assert-count: ("dl.item-table dt", 2)
1010
// If they don't have the same height, then it means one of the two is on two lines whereas it
1111
// shouldn't!
1212
compare-elements-size: (
13-
".item-table .item-name a[href='fn.mult_vec_num.html']",
14-
".item-table .item-name a[href='fn.subt_vec_num.html']",
13+
".item-table dt a[href='fn.mult_vec_num.html']",
14+
".item-table dt a[href='fn.subt_vec_num.html']",
1515
["height"],
1616
)
1717

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// This test ensures that <table> elements aren't display in items summary.
22
go-to: "file://" + |DOC_PATH| + "/lib2/summary_table/index.html"
33
// We check that we picked the right item first.
4-
assert-text: (".item-table .item-name", "Foo")
4+
assert-text: (".item-table dt", "Foo")
55
// Then we check that its summary is empty.
6-
assert-false: ".item-table .desc"
6+
assert-false: ".item-table dd"

tests/rustdoc-gui/label-next-to-symbol.goml

+18-18
Original file line numberDiff line numberDiff line change
@@ -12,59 +12,59 @@ assert: (".stab.portability")
1212

1313
// make sure that deprecated and portability have the right colors
1414
assert-css: (
15-
".item-table .item-name .stab.deprecated",
15+
".item-table dt .stab.deprecated",
1616
{ "background-color": "#fff5d6" },
1717
)
1818
assert-css: (
19-
".item-table .item-name .stab.portability",
19+
".item-table dt .stab.portability",
2020
{ "background-color": "#fff5d6" },
2121
)
2222

2323
// table like view
24-
assert-css: (".desc.docblock-short", { "padding-left": "0px" })
24+
assert-css: ("dd", { "padding-left": "0px" })
2525
compare-elements-position-near: (
26-
"//*[@class='item-name']//a[normalize-space()='replaced_function']",
27-
".item-name .stab.deprecated",
26+
"//dt//a[normalize-space()='replaced_function']",
27+
"dt .stab.deprecated",
2828
{"y": 2},
2929
)
3030
// "Unix" part is on second line
3131
compare-elements-position-false: (
32-
".item-name .stab.deprecated",
33-
".item-name .stab.portability",
32+
"dt .stab.deprecated",
33+
"dt .stab.portability",
3434
["y"],
3535
)
3636

3737
// Ensure no wrap
3838
compare-elements-position: (
39-
"//*[@class='item-name']//a[normalize-space()='replaced_function']/..",
40-
"//*[@class='desc docblock-short'][normalize-space()='a thing with a label']",
39+
"//dt//a[normalize-space()='replaced_function']/..",
40+
"//dd[normalize-space()='a thing with a label']",
4141
["y"],
4242
)
4343

4444
// Mobile view
4545
set-window-size: (600, 600)
4646
// staggered layout with 2em spacing
47-
assert-css: (".desc.docblock-short", { "padding-left": "32px" })
47+
assert-css: ("dd", { "padding-left": "32px" })
4848
compare-elements-position-near: (
49-
"//*[@class='item-name']//a[normalize-space()='replaced_function']",
50-
".item-name .stab.deprecated",
49+
"//dt//a[normalize-space()='replaced_function']",
50+
"dt .stab.deprecated",
5151
{"y": 2},
5252
)
5353
compare-elements-position: (
54-
".item-name .stab.deprecated",
55-
".item-name .stab.portability",
54+
"dt .stab.deprecated",
55+
"dt .stab.portability",
5656
["y"],
5757
)
5858

5959
// Ensure wrap
6060
compare-elements-position-false: (
61-
"//*[@class='item-name']//a[normalize-space()='replaced_function']/..",
62-
"//*[@class='desc docblock-short'][normalize-space()='a thing with a label']",
61+
"//dt//a[normalize-space()='replaced_function']/..",
62+
"//dd[normalize-space()='a thing with a label']",
6363
["y"],
6464
)
6565
compare-elements-position-false: (
66-
".item-name .stab.deprecated",
67-
"//*[@class='desc docblock-short'][normalize-space()='a thing with a label']",
66+
"dt .stab.deprecated",
67+
"//dd[normalize-space()='a thing with a label']",
6868
["y"],
6969
)
7070

tests/rustdoc-gui/links-color.goml

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ define-function: (
3737
},
3838
ALL,
3939
)
40-
move-cursor-to: ".desc a[href='long_code_block_link/index.html']"
40+
move-cursor-to: "dd a[href='long_code_block_link/index.html']"
4141
assert-css: (
42-
".desc a[href='long_code_block_link/index.html']",
42+
"dd a[href='long_code_block_link/index.html']",
4343
{"text-decoration": "underline solid " + |mod|},
4444
)
4545
},
+14-14
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,67 @@
11
// This test checks that the correct font is used on module items (in index.html pages).
22
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
33
assert-css: (
4-
".item-table .item-name > a",
4+
".item-table dt > a",
55
{"font-family": '"Fira Sans", Arial, NanumBarunGothic, sans-serif'},
66
ALL,
77
)
88
assert-css: (
9-
".item-table .docblock-short",
9+
".item-table dd",
1010
{"font-family": '"Source Serif 4", NanumBarunGothic, serif'},
1111
ALL,
1212
)
1313

1414
// modules
1515
assert-css: (
16-
"#modules + .item-table .item-name a",
16+
"#modules + .item-table dt a",
1717
{"font-family": '"Fira Sans", Arial, NanumBarunGothic, sans-serif'},
1818
)
1919
assert-css: (
20-
"#modules + .item-table .desc.docblock-short",
20+
"#modules + .item-table ",
2121
{"font-family": '"Source Serif 4", NanumBarunGothic, serif'},
2222
)
2323
// structs
2424
assert-css: (
25-
"#structs + .item-table .item-name a",
25+
"#structs + .item-table dt a",
2626
{"font-family": '"Fira Sans", Arial, NanumBarunGothic, sans-serif'},
2727
)
2828
assert-css: (
29-
"#structs + .item-table .desc.docblock-short",
29+
"#structs + .item-table dd",
3030
{"font-family": '"Source Serif 4", NanumBarunGothic, serif'},
3131
)
3232
// enums
3333
assert-css: (
34-
"#enums + .item-table .item-name a",
34+
"#enums + .item-table dt a",
3535
{"font-family": '"Fira Sans", Arial, NanumBarunGothic, sans-serif'},
3636
)
3737
assert-css: (
38-
"#enums + .item-table .desc.docblock-short",
38+
"#enums + .item-table dd",
3939
{"font-family": '"Source Serif 4", NanumBarunGothic, serif'},
4040
)
4141
// traits
4242
assert-css: (
43-
"#traits + .item-table .item-name a",
43+
"#traits + .item-table dt a",
4444
{"font-family": '"Fira Sans", Arial, NanumBarunGothic, sans-serif'},
4545
)
4646
assert-css: (
47-
"#traits + .item-table .desc.docblock-short",
47+
"#traits + .item-table dd",
4848
{"font-family": '"Source Serif 4", NanumBarunGothic, serif'},
4949
)
5050
// functions
5151
assert-css: (
52-
"#functions + .item-table .item-name a",
52+
"#functions + .item-table dt a",
5353
{"font-family": '"Fira Sans", Arial, NanumBarunGothic, sans-serif'},
5454
)
5555
assert-css: (
56-
"#functions + .item-table .desc.docblock-short",
56+
"#functions + .item-table dd",
5757
{"font-family": '"Source Serif 4", NanumBarunGothic, serif'},
5858
)
5959
// keywords
6060
assert-css: (
61-
"#keywords + .item-table .item-name a",
61+
"#keywords + .item-table dt a",
6262
{"font-family": '"Fira Sans", Arial, NanumBarunGothic, sans-serif'},
6363
)
6464
assert-css: (
65-
"#keywords + .item-table .desc.docblock-short",
65+
"#keywords + .item-table dd",
6666
{"font-family": '"Source Serif 4", NanumBarunGothic, serif'},
6767
)

tests/rustdoc-gui/sidebar.goml

+5-5
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ assert-text: (".sidebar-elems section ul > li:nth-child(8)", "Functions")
6565
assert-text: (".sidebar-elems section ul > li:nth-child(9)", "Type Aliases")
6666
assert-text: (".sidebar-elems section ul > li:nth-child(10)", "Unions")
6767
assert-text: (".sidebar-elems section ul > li:nth-child(11)", "Keywords")
68-
assert-text: ("#structs + .item-table .item-name > a", "Foo")
69-
click: "#structs + .item-table .item-name > a"
68+
assert-text: ("#structs + .item-table dt > a", "Foo")
69+
click: "#structs + .item-table dt > a"
7070

7171
// PAGE: struct.Foo.html
7272
assert-count: (".sidebar .sidebar-crate", 1)
@@ -101,8 +101,8 @@ assert-text: (".sidebar-elems > section ul.block > li:nth-child(2)", "Structs")
101101
assert-text: (".sidebar-elems > section ul.block > li:nth-child(3)", "Traits")
102102
assert-text: (".sidebar-elems > section ul.block > li:nth-child(4)", "Functions")
103103
assert-text: (".sidebar-elems > section ul.block > li:nth-child(5)", "Type Aliases")
104-
assert-text: ("#functions + .item-table .item-name > a", "foobar")
105-
click: "#functions + .item-table .item-name > a"
104+
assert-text: ("#functions + .item-table dt > a", "foobar")
105+
click: "#functions + .item-table dt > a"
106106

107107
// PAGE: fn.foobar.html
108108
// In items containing no items (like functions or constants) and in modules, we have no
@@ -145,7 +145,7 @@ assert-text: (".sidebar-elems ul.block > li.current > a", "sub_sub_module")
145145
// We check that we don't have the crate list.
146146
assert-false: ".sidebar-elems .crate"
147147
assert-text: (".sidebar-elems > section ul > li:nth-child(1)", "Functions")
148-
assert-text: ("#functions + .item-table .item-name > a", "foo")
148+
assert-text: ("#functions + .item-table dt > a", "foo")
149149

150150
// Links to trait implementations in the sidebar should not wrap even if they are long.
151151
go-to: "file://" + |DOC_PATH| + "/lib2/struct.HasALongTraitWithParams.html"

tests/rustdoc-gui/unsafe-fn.goml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ define-function: (
1717
[theme, color],
1818
block {
1919
call-function: ("switch-theme", {"theme": |theme|})
20-
assert-css: (".item-name sup", {"color": |color|})
20+
assert-css: ("dt sup", {"color": |color|})
2121
},
2222
)
2323

tests/rustdoc/anonymous-reexport.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//@ has - '//*[@id="main-content"]/h2' 'Structs'
1010
//@ has - '//*[@id="main-content"]/h2' 'Re-exports'
1111
// The 3 re-exports.
12-
//@ count - '//*[@id="main-content"]//*[@class="item-table"]/dt//code' 3
12+
//@ count - '//*[@id="main-content"]//*[@class="item-table reexports"]/dt//code' 3
1313
// The public struct.
1414
//@ count - '//*[@id="main-content"]//a[@class="struct"]' 1
1515

0 commit comments

Comments
 (0)