about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJacob Hoffman-Andrews <github@hoffman-andrews.com>2021-06-01 21:43:09 -0700
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2021-06-02 20:30:17 +0200
commitfab6814ff3033108a2f4a1b16bf51ad8ffd0e36f (patch)
tree75fcc969ea497306f26fc011eaa169f22eeaa16a
parent98a9b02e928854dfdddb94627fc463ad93b61279 (diff)
downloadrust-fab6814ff3033108a2f4a1b16bf51ad8ffd0e36f.tar.gz
rust-fab6814ff3033108a2f4a1b16bf51ad8ffd0e36f.zip
Remove data-level selectors from CSS.
-rw-r--r--src/librustdoc/html/render/mod.rs16
-rw-r--r--src/librustdoc/html/render/print_item.rs2
-rw-r--r--src/librustdoc/html/static/rustdoc.css84
3 files changed, 20 insertions, 82 deletions
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs
index d888a5a52a9..21d588e42f8 100644
--- a/src/librustdoc/html/render/mod.rs
+++ b/src/librustdoc/html/render/mod.rs
@@ -1371,7 +1371,7 @@ fn render_impl(
                         .map(|item| format!("{}.{}", item.type_(), name));
                     write!(
                         w,
-                        "<div id=\"{}\" class=\"{}{}\" data-level=\"2\">",
+                        "<div id=\"{}\" class=\"{}{} has-srclink\">",
                         id, item_type, in_trait_class,
                     );
                     w.write_str("<code>");
@@ -1400,7 +1400,7 @@ fn render_impl(
                 let id = cx.derive_id(source_id.clone());
                 write!(
                     w,
-                    "<div id=\"{}\" class=\"{}{}\" data-level=\"2\"><code>",
+                    "<div id=\"{}\" class=\"{}{} has-srclink\"><code>",
                     id, item_type, in_trait_class
                 );
                 assoc_type(
@@ -1421,7 +1421,7 @@ fn render_impl(
                 let id = cx.derive_id(source_id.clone());
                 write!(
                     w,
-                    "<div id=\"{}\" class=\"{}{}\" data-level=\"2\"><code>",
+                    "<div id=\"{}\" class=\"{}{} has-srclink\"><code>",
                     id, item_type, in_trait_class
                 );
                 assoc_const(
@@ -1448,11 +1448,7 @@ fn render_impl(
             clean::AssocTypeItem(ref bounds, ref default) => {
                 let source_id = format!("{}.{}", item_type, name);
                 let id = cx.derive_id(source_id.clone());
-                write!(
-                    w,
-                    "<div id=\"{}\" class=\"{}{}\" data-level=\"2\"><code>",
-                    id, item_type, in_trait_class,
-                );
+                write!(w, "<div id=\"{}\" class=\"{}{}\"><code>", id, item_type, in_trait_class,);
                 assoc_type(
                     w,
                     item,
@@ -1593,7 +1589,7 @@ fn render_impl(
         if let Some(use_absolute) = use_absolute {
             write!(
                 w,
-                "{}<div id=\"{}\" class=\"impl\"{} data-level=\"1\">\
+                "{}<div id=\"{}\" class=\"impl has-srclink\"{}>\
                      <code class=\"in-band\">",
                 open_details(&mut close_tags, is_implementing_trait),
                 id,
@@ -1621,7 +1617,7 @@ fn render_impl(
         } else {
             write!(
                 w,
-                "{}<div id=\"{}\" class=\"impl\"{} data-level=\"1\">\
+                "{}<div id=\"{}\" class=\"impl has-srclink\"{}>\
                      <code class=\"in-band\">{}</code>",
                 open_details(&mut close_tags, is_implementing_trait),
                 id,
diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs
index 24f56913a23..61b6833c2b2 100644
--- a/src/librustdoc/html/render/print_item.rs
+++ b/src/librustdoc/html/render/print_item.rs
@@ -585,7 +585,7 @@ fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra
         if toggled {
             write!(w, "<details class=\"rustdoc-toggle\" open><summary>");
         }
-        write!(w, "<div id=\"{}\" class=\"method\" data-level=\"1\"><code>", id);
+        write!(w, "<div id=\"{}\" class=\"method has-srclink\"><code>", id);
         render_assoc_item(w, m, AssocItemLink::Anchor(Some(&id)), ItemType::Impl, cx);
         w.write_str("</code>");
         render_stability_since(w, m, t, cx.tcx());
diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css
index f53d5f9c540..8dad9f85386 100644
--- a/src/librustdoc/html/static/rustdoc.css
+++ b/src/librustdoc/html/static/rustdoc.css
@@ -137,19 +137,19 @@ h1.fqn > .in-band > a:hover {
 h2, h3, h4 {
 	border-bottom: 1px solid;
 }
-div[data-level="1"].impl, div[data-level="1"].method, div[data-level="2"].method,
-div[data-level="1"].type, div[data-level="2"].type, div[data-level="2"].associatedconstant,
-div[data-level="2"].associatedtype {
+.impl, .method,
+.type, .associatedconstant,
+.associatedtype {
 	flex-basis: 100%;
 	font-weight: 600;
 	margin-top: 16px;
 	margin-bottom: 10px;
 	position: relative;
 }
-div[data-level="1"].impl, div[data-level="1"].method, div[data-level="2"].method.trait-impl,
-div[data-level="1"].type, div[data-level="2"].type.trait-impl,
-div[data-level="2"].associatedconstant.trait-impl,
-div[data-level="2"].associatedtype.trait-impl {
+.impl, .method.trait-impl,
+.type.trait-impl,
+.associatedconstant.trait-impl,
+.associatedtype.trait-impl {
 	padding-left: 15px;
 }
 
@@ -160,7 +160,7 @@ div.impl-items > div {
 h1, h2, h3, h4,
 .sidebar, a.source, .search-input, .search-results .result-name,
 .content table td:first-child > a,
-.collapse-toggle, div.item-list .out-of-band, span.since,
+div.item-list .out-of-band, span.since,
 #source-sidebar, #sidebar-toggle,
 details.rustdoc-toggle > summary::before,
 details.undocumented > summary::before,
@@ -467,15 +467,7 @@ nav.sub {
 	font-weight: normal;
 }
 
-div[data-level="1"].impl > .out-of-band {
-	font-size: 21px;
-}
-
-div[data-level="2"].method > .out-of-band {
-	font-size: 19px;
-}
-
-div[data-level="1"] > code, div[data-level="2"] > code, .invisible > code {
+.method > code, .trait-impl > code, .invisible > code {
 	max-width: calc(100% - 41px);
 	display: block;
 }
@@ -548,7 +540,7 @@ div[data-level="1"] > code, div[data-level="2"] > code, .invisible > code {
 }
 .content .multi-column li { width: 100%; display: inline-block; }
 
-.content > div.methods > div.method {
+.content > .methods > .method {
 	font-size: 1em;
 	position: relative;
 }
@@ -569,9 +561,6 @@ div[data-level="1"] > code, div[data-level="2"] > code, .invisible > code {
 	margin-left: 20px;
 	margin-top: -34px;
 }
-.content .docblock > .impl-items > div[data-level="2"] {
-	border-bottom: 0;
-}
 .content .docblock >.impl-items .table-display {
 	margin: 0;
 }
@@ -694,7 +683,7 @@ a {
 }
 
 .invisible > .srclink,
-div[data-level="1"] > code + .srclink, div[data-level="2"] > code + .srclink {
+.method > code + .srclink {
 	position: absolute;
 	top: 0;
 	right: 0;
@@ -929,8 +918,7 @@ body.blur > :not(#help) {
 	flex-grow: 1;
 }
 
-.impl-items div[data-level="2"], div[data-level="2"].impl, div[data-level="1"].impl,
-.methods div[data-level="1"] {
+.has-srclink {
 	display: flex;
 	flex-basis: 100%;
 	font-size: 16px;
@@ -992,45 +980,6 @@ a.test-arrow:hover{
 	font-weight: 300;
 }
 
-.collapse-toggle {
-	font-weight: 300;
-	position: absolute;
-	left: -23px;
-	top: 0;
-}
-
-div[data-level="1"] > .collapse-toggle, div[data-level="2"] > .collapse-toggle {
-	font-size: 0.8em;
-	top: 5px;
-}
-
-.toggle-wrapper > .collapse-toggle {
-	left: -24px;
-	margin-top: 0px;
-}
-
-.toggle-wrapper {
-	position: relative;
-	margin-top: 0;
-}
-
-.toggle-wrapper.collapsed {
-	height: 25px;
-	transition: height .2s;
-	margin-bottom: .6em;
-}
-
-.collapse-toggle > .inner {
-	display: inline-block;
-	width: 1.2ch;
-	text-align: center;
-}
-
-.collapse-toggle.hidden-default {
-	position: relative;
-	margin-left: 20px;
-}
-
 .since + .srclink {
 	display: table-cell;
 	padding-left: 10px;
@@ -1241,9 +1190,6 @@ pre.rust {
 	cursor: pointer;
 	z-index: 2;
 	margin-left: 5px;
-}
-
-div[data-level="2"] > .notable-traits {
 	position: absolute;
 	left: -44px;
 	top: 2px;
@@ -1661,10 +1607,6 @@ details.undocumented[open] > summary::before {
 		padding: 0;
 	}
 
-	.content div[data-level="2"] > .out-of-band {
-		position: inherit;
-	}
-
 	#search {
 		margin-left: 0;
 	}
@@ -1684,7 +1626,7 @@ details.undocumented[open] > summary::before {
 		z-index: 1;
 	}
 
-	div[data-level="2"] > .notable-traits {
+	.notable-traits {
 		position: absolute;
 		left: -22px;
 		top: 24px;