Rollup merge of #105756 - notriddle:notriddle/example-wrap-tooltip, r=GuillaumeGomez

rustdoc: simplify CSS for codeblock tooltips

Instead of making its parts `display: none` and then changing it on hover, just make the pseudo-element itself on hover.
This commit is contained in:
Matthias Krüger 2022-12-16 14:02:19 +01:00 committed by GitHub
commit 0820bb2826
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 15 deletions

View File

@ -1118,8 +1118,7 @@ pre.rust .doccomment {
top: 5px;
}
.example-wrap .tooltip::after {
display: none;
.example-wrap .tooltip:hover::after {
text-align: center;
padding: 5px 3px 3px 3px;
border-radius: 6px;
@ -1134,35 +1133,30 @@ pre.rust .doccomment {
color: var(--tooltip-color);
}
.example-wrap .tooltip::before {
.example-wrap .tooltip:hover::before {
content: " ";
position: absolute;
top: 50%;
left: 16px;
margin-top: -5px;
display: none;
z-index: 1;
border: 5px solid transparent;
border-right-color: var(--tooltip-background-color);
}
.example-wrap.ignore .tooltip::after {
.example-wrap.ignore .tooltip:hover::after {
content: "This example is not tested";
}
.example-wrap.compile_fail .tooltip::after {
.example-wrap.compile_fail .tooltip:hover::after {
content: "This example deliberately fails to compile";
}
.example-wrap.should_panic .tooltip::after {
.example-wrap.should_panic .tooltip:hover::after {
content: "This example panics";
}
.example-wrap.edition .tooltip::after {
.example-wrap.edition .tooltip:hover::after {
content: "This code runs with edition " attr(data-edition);
}
.example-wrap .tooltip:hover::before, .example-wrap .tooltip:hover::after {
display: inline;
}
.example-wrap.compile_fail .tooltip,
.example-wrap.should_panic .tooltip,
.example-wrap.ignore .tooltip {

View File

@ -20,7 +20,7 @@ define-function: (
{"border-left": "2px solid rgba(255, 0, 0, 0.5)"},
)),
("move-cursor-to", ".docblock .example-wrap.compile_fail"),
("move-cursor-to", ".docblock .example-wrap.compile_fail .tooltip"),
("assert-css", (
".docblock .example-wrap.compile_fail .tooltip",
@ -60,7 +60,7 @@ define-function: (
{"border-left": "2px solid rgba(255, 0, 0, 0.5)"},
)),
("move-cursor-to", ".docblock .example-wrap.should_panic"),
("move-cursor-to", ".docblock .example-wrap.should_panic .tooltip"),
("assert-css", (
".docblock .example-wrap.should_panic .tooltip",
@ -100,7 +100,7 @@ define-function: (
{"border-left": "2px solid rgba(255, 142, 0, 0.6)"},
)),
("move-cursor-to", ".docblock .example-wrap.ignore"),
("move-cursor-to", ".docblock .example-wrap.ignore .tooltip"),
("assert-css", (
".docblock .example-wrap.ignore .tooltip",