Skip to content

Commit a979b4a

Browse files
committed
rustdoc: use real buttons for scrape examples controls
1 parent 62c627c commit a979b4a

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

src/librustdoc/html/render/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2915,7 +2915,7 @@ fn render_call_locations(w: &mut Buffer, cx: &mut Context<'_>, item: &clean::Ite
29152915
);
29162916

29172917
if line_ranges.len() > 1 {
2918-
write!(w, r#"<span class="prev">&pr;</span> <span class="next">&sc;</span>"#);
2918+
write!(w, r#"<button class="prev">&pr;</button> <button class="next">&sc;</button>"#);
29192919
}
29202920

29212921
// Look for the example file in the source map if it exists, otherwise return a dummy span

src/librustdoc/html/sources.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,11 @@ pub(crate) fn print_src(
287287
}
288288
}
289289
SourceContext::Embedded { offset, needs_expansion } => {
290-
extra =
291-
if needs_expansion { Some(r#"<span class="expand">&varr;</span>"#) } else { None };
290+
extra = if needs_expansion {
291+
Some(r#"<button class="expand">&varr;</button>"#)
292+
} else {
293+
None
294+
};
292295
for line_number in 1..=lines {
293296
let line = line_number + offset;
294297
writeln!(line_numbers, "<span>{line}</span>")

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1959,6 +1959,12 @@ in storage.js
19591959
top: 0.25em;
19601960
z-index: 1;
19611961
cursor: pointer;
1962+
padding: 0;
1963+
background: none;
1964+
border: none;
1965+
/* iOS button gradient: https://stackoverflow.com/q/5438567 */
1966+
-webkit-appearance: none;
1967+
opacity: 1;
19621968
}
19631969
.scraped-example .code-wrapper .prev {
19641970
right: 2.25em;

0 commit comments

Comments
 (0)