Skip to content

Commit

Permalink
rustdoc: get rid of CSS/DOM div.desc span, which isn't really needed
Browse files Browse the repository at this point in the history
  • Loading branch information
notriddle committed Nov 4, 2022
1 parent b30c4d1 commit 4bd6748
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
15 changes: 7 additions & 8 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -881,13 +881,6 @@ so that we can apply CSS-filters to change the arrow color in themes */
display: block;
}

.search-results .desc > span {
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
display: block;
}

.search-results > a {
display: flex;
/* A little margin ensures the browser's outlining of focused links has room to display. */
Expand All @@ -899,7 +892,13 @@ so that we can apply CSS-filters to change the arrow color in themes */

.search-results > a > div {
flex: 1;
}

.search-results > a > div.desc {
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
display: block;
}

.search-results a:hover,
Expand Down Expand Up @@ -1870,7 +1869,7 @@ in storage.js
.search-results > a {
padding: 5px 0px;
}
.search-results div.desc, .item-right {
.search-results > a > div.desc, .item-right {
padding-left: 2em;
}

Expand Down
4 changes: 1 addition & 3 deletions src/librustdoc/html/static/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -1617,10 +1617,8 @@ function initSearch(rawSearchIndex) {

const description = document.createElement("div");
description.className = "desc";
const spanDesc = document.createElement("span");
spanDesc.insertAdjacentHTML("beforeend", item.desc);
description.insertAdjacentHTML("beforeend", item.desc);

description.appendChild(spanDesc);
link.appendChild(description);
output.appendChild(link);
});
Expand Down
8 changes: 4 additions & 4 deletions src/test/rustdoc-gui/search-result-color.goml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ reload:
// Waiting for the search results to appear...
wait-for: "#titles"
assert-css: (
"//*[@class='desc']//*[text()='Just a normal struct.']",
"//*[@class='desc'][text()='Just a normal struct.']",
{"color": "rgb(197, 197, 197)"},
)
assert-css: (
Expand Down Expand Up @@ -159,7 +159,7 @@ assert-css: (
)

// Checking color and background on hover.
move-cursor-to: "//*[@class='desc']//*[text()='Just a normal struct.']"
move-cursor-to: "//*[@class='desc'][text()='Just a normal struct.']"
assert-css: (
"//*[@class='result-name']/*[text()='test_docs::']",
{"color": "rgb(255, 255, 255)"},
Expand All @@ -179,7 +179,7 @@ reload:
// Waiting for the search results to appear...
wait-for: "#titles"
assert-css: (
"//*[@class='desc']//*[text()='Just a normal struct.']",
"//*[@class='desc'][text()='Just a normal struct.']",
{"color": "rgb(221, 221, 221)"},
)
assert-css: (
Expand Down Expand Up @@ -276,7 +276,7 @@ reload:
// Waiting for the search results to appear...
wait-for: "#titles"
assert-css: (
"//*[@class='desc']//*[text()='Just a normal struct.']",
"//*[@class='desc'][text()='Just a normal struct.']",
{"color": "rgb(0, 0, 0)"},
)
assert-css: (
Expand Down

0 comments on commit 4bd6748

Please sign in to comment.