Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix text selection for page titles #81397

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 34 additions & 32 deletions src/librustdoc/html/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1347,6 +1347,7 @@ impl AllTypes {
write!(
f,
"<h1 class=\"fqn\">\
<span class=\"in-band\">List of all items</span>\
<span class=\"out-of-band\">\
<span id=\"render-detail\">\
<a id=\"toggle-all-docs\" href=\"javascript:void(0)\" \
Expand All @@ -1355,7 +1356,6 @@ impl AllTypes {
</a>\
</span>
</span>
<span class=\"in-band\">List of all items</span>\
</h1>"
);
print_entries(f, &self.structs, "Structs", "structs");
Expand Down Expand Up @@ -1712,37 +1712,9 @@ where

fn print_item(cx: &Context<'_>, item: &clean::Item, buf: &mut Buffer, cache: &Cache) {
debug_assert!(!item.is_stripped());
// Write the breadcrumb trail header for the top
write!(buf, "<h1 class=\"fqn\"><span class=\"out-of-band\">");
render_stability_since_raw(
buf,
item.stable_since(cx.tcx()).as_deref(),
item.const_stable_since(cx.tcx()).as_deref(),
None,
None,
);
write!(
buf,
"<span id=\"render-detail\">\
<a id=\"toggle-all-docs\" href=\"javascript:void(0)\" \
title=\"collapse all docs\">\
[<span class=\"inner\">&#x2212;</span>]\
</a>\
</span>"
);

// Write `src` tag
//
// When this item is part of a `crate use` in a downstream crate, the
// [src] link in the downstream documentation will actually come back to
// this page, and this link will be auto-clicked. The `id` attribute is
// used to find the link to auto-click.
if cx.shared.include_sources && !item.is_primitive() {
write_srclink(cx, item, buf, cache);
}

write!(buf, "</span>"); // out-of-band
write!(buf, "<span class=\"in-band\">");
// Write the breadcrumb trail header for the top
write!(buf, "<h1 class=\"fqn\"><span class=\"in-band\">");
let name = match *item.kind {
clean::ModuleItem(ref m) => {
if m.is_crate {
Expand Down Expand Up @@ -1790,7 +1762,37 @@ fn print_item(cx: &Context<'_>, item: &clean::Item, buf: &mut Buffer, cache: &Ca
}
write!(buf, "<a class=\"{}\" href=\"\">{}</a>", item.type_(), item.name.as_ref().unwrap());

write!(buf, "</span></h1>"); // in-band
write!(buf, "</span>"); // in-band

write!(buf, "<span class=\"out-of-band\">");
render_stability_since_raw(
buf,
item.stable_since(cx.tcx()).as_deref(),
item.const_stable_since(cx.tcx()).as_deref(),
None,
None,
);
write!(
buf,
"<span id=\"render-detail\">\
<a id=\"toggle-all-docs\" href=\"javascript:void(0)\" \
title=\"collapse all docs\">\
[<span class=\"inner\">&#x2212;</span>]\
</a>\
</span>"
);

// Write `src` tag
//
// When this item is part of a `crate use` in a downstream crate, the
// [src] link in the downstream documentation will actually come back to
// this page, and this link will be auto-clicked. The `id` attribute is
// used to find the link to auto-click.
if cx.shared.include_sources && !item.is_primitive() {
write_srclink(cx, item, buf, cache);
}

write!(buf, "</span></h1>"); // out-of-band

match *item.kind {
clean::ModuleItem(ref m) => item_module(buf, cx, item, &m.items),
Expand Down