Skip to content

Commit 4bd6748

Browse files
committed
rustdoc: get rid of CSS/DOM div.desc span, which isn't really needed
1 parent b30c4d1 commit 4bd6748

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

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

+7-8
Original file line numberDiff line numberDiff line change
@@ -881,13 +881,6 @@ so that we can apply CSS-filters to change the arrow color in themes */
881881
display: block;
882882
}
883883

884-
.search-results .desc > span {
885-
white-space: nowrap;
886-
text-overflow: ellipsis;
887-
overflow: hidden;
888-
display: block;
889-
}
890-
891884
.search-results > a {
892885
display: flex;
893886
/* A little margin ensures the browser's outlining of focused links has room to display. */
@@ -899,7 +892,13 @@ so that we can apply CSS-filters to change the arrow color in themes */
899892

900893
.search-results > a > div {
901894
flex: 1;
895+
}
896+
897+
.search-results > a > div.desc {
898+
white-space: nowrap;
899+
text-overflow: ellipsis;
902900
overflow: hidden;
901+
display: block;
903902
}
904903

905904
.search-results a:hover,
@@ -1870,7 +1869,7 @@ in storage.js
18701869
.search-results > a {
18711870
padding: 5px 0px;
18721871
}
1873-
.search-results div.desc, .item-right {
1872+
.search-results > a > div.desc, .item-right {
18741873
padding-left: 2em;
18751874
}
18761875

src/librustdoc/html/static/js/search.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -1617,10 +1617,8 @@ function initSearch(rawSearchIndex) {
16171617

16181618
const description = document.createElement("div");
16191619
description.className = "desc";
1620-
const spanDesc = document.createElement("span");
1621-
spanDesc.insertAdjacentHTML("beforeend", item.desc);
1620+
description.insertAdjacentHTML("beforeend", item.desc);
16221621

1623-
description.appendChild(spanDesc);
16241622
link.appendChild(description);
16251623
output.appendChild(link);
16261624
});

src/test/rustdoc-gui/search-result-color.goml

+4-4
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ reload:
6767
// Waiting for the search results to appear...
6868
wait-for: "#titles"
6969
assert-css: (
70-
"//*[@class='desc']//*[text()='Just a normal struct.']",
70+
"//*[@class='desc'][text()='Just a normal struct.']",
7171
{"color": "rgb(197, 197, 197)"},
7272
)
7373
assert-css: (
@@ -159,7 +159,7 @@ assert-css: (
159159
)
160160

161161
// Checking color and background on hover.
162-
move-cursor-to: "//*[@class='desc']//*[text()='Just a normal struct.']"
162+
move-cursor-to: "//*[@class='desc'][text()='Just a normal struct.']"
163163
assert-css: (
164164
"//*[@class='result-name']/*[text()='test_docs::']",
165165
{"color": "rgb(255, 255, 255)"},
@@ -179,7 +179,7 @@ reload:
179179
// Waiting for the search results to appear...
180180
wait-for: "#titles"
181181
assert-css: (
182-
"//*[@class='desc']//*[text()='Just a normal struct.']",
182+
"//*[@class='desc'][text()='Just a normal struct.']",
183183
{"color": "rgb(221, 221, 221)"},
184184
)
185185
assert-css: (
@@ -276,7 +276,7 @@ reload:
276276
// Waiting for the search results to appear...
277277
wait-for: "#titles"
278278
assert-css: (
279-
"//*[@class='desc']//*[text()='Just a normal struct.']",
279+
"//*[@class='desc'][text()='Just a normal struct.']",
280280
{"color": "rgb(0, 0, 0)"},
281281
)
282282
assert-css: (

0 commit comments

Comments
 (0)