Skip to content

Commit d7e998d

Browse files
Rename ID "main" into "main-content"
1 parent 1e55c31 commit d7e998d

25 files changed

+88
-90
lines changed

src/librustdoc/html/markdown.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1447,7 +1447,7 @@ fn init_id_map() -> FxHashMap<String, usize> {
14471447
map.insert("theme-choices".to_owned(), 1);
14481448
map.insert("settings-menu".to_owned(), 1);
14491449
map.insert("help-button".to_owned(), 1);
1450-
map.insert("main".to_owned(), 1);
1450+
map.insert("main-content".to_owned(), 1);
14511451
map.insert("search".to_owned(), 1);
14521452
map.insert("crate-search".to_owned(), 1);
14531453
map.insert("render-detail".to_owned(), 1);

src/librustdoc/html/markdown/tests.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ fn test_unique_id() {
1212
"examples",
1313
"method.into_iter",
1414
"foo",
15-
"main",
15+
"main-content",
1616
"search",
1717
"methods",
1818
"examples",
@@ -28,7 +28,7 @@ fn test_unique_id() {
2828
"examples-2",
2929
"method.into_iter-1",
3030
"foo-1",
31-
"main-1",
31+
"main-content-1",
3232
"search-1",
3333
"methods",
3434
"examples-3",
@@ -219,8 +219,8 @@ fn test_header_ids_multiple_blocks() {
219219
);
220220
t(
221221
&mut map,
222-
"# Main",
223-
"<h2 id=\"main-1\" class=\"section-header\"><a href=\"#main-1\">Main</a></h2>",
222+
"# Search",
223+
"<h2 id=\"search-1\" class=\"section-header\"><a href=\"#search-1\">Search</a></h2>",
224224
);
225225
t(
226226
&mut map,

src/librustdoc/html/static/css/noscript.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ of content is hidden by default (depending on the settings too), we have to over
44
rules.
55
*/
66

7-
#main .attributes {
7+
#main-content .attributes {
88
/* Since there is no toggle (the "[-]") when JS is disabled, no need for this margin either. */
99
margin-left: 0 !important;
1010
}

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ details.rustdoc-toggle > summary::before,
201201
div.impl-items > div:not(.docblock):not(.item-info),
202202
.content ul.crate a.crate, a.srclink,
203203
/* This selector is for the items listed in the "all items" page. */
204-
#main > ul.docblock > li > a {
204+
#main-content > ul.docblock > li > a {
205205
font-family: "Fira Sans", Arial, NanumBarunGothic, sans-serif;
206206
}
207207

@@ -633,10 +633,10 @@ nav.sub {
633633
display: inline-block;
634634
}
635635

636-
#main {
636+
#main-content {
637637
position: relative;
638638
}
639-
#main > .since {
639+
#main-content > .since {
640640
top: inherit;
641641
font-family: "Fira Sans", Arial, sans-serif;
642642
}
@@ -755,7 +755,7 @@ nav.sub {
755755
flex-basis: 100%;
756756
}
757757

758-
#main > .item-info {
758+
#main-content > .item-info {
759759
margin-top: 0;
760760
}
761761

@@ -1521,10 +1521,10 @@ kbd {
15211521
left: -5px;
15221522
}
15231523

1524-
#main > ul {
1524+
#main-content > ul {
15251525
padding-left: 10px;
15261526
}
1527-
#main > ul > li {
1527+
#main-content > ul > li {
15281528
list-style: none;
15291529
}
15301530

@@ -1920,8 +1920,8 @@ details.rustdoc-toggle[open] > summary.hideme::after {
19201920
border-bottom: 1px solid;
19211921
}
19221922

1923-
#main > details.rustdoc-toggle > summary::before,
1924-
#main > div > details.rustdoc-toggle > summary::before {
1923+
#main-content > details.rustdoc-toggle > summary::before,
1924+
#main-content > div > details.rustdoc-toggle > summary::before {
19251925
left: -11px;
19261926
}
19271927

@@ -1954,7 +1954,7 @@ details.rustdoc-toggle[open] > summary.hideme::after {
19541954
z-index: 11;
19551955
}
19561956

1957-
#main > .line-numbers {
1957+
#main-content > .line-numbers {
19581958
margin-top: 0;
19591959
}
19601960

@@ -2008,7 +2008,7 @@ details.rustdoc-toggle[open] > summary.hideme::after {
20082008
height: 73px;
20092009
}
20102010

2011-
#main > table:not(.table-display) td {
2011+
#main-content > table:not(.table-display) td {
20122012
word-break: break-word;
20132013
width: 50%;
20142014
}

src/librustdoc/html/static/js/main.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ function getVirtualKey(ev) {
9494

9595
var THEME_PICKER_ELEMENT_ID = "theme-picker";
9696
var THEMES_ELEMENT_ID = "theme-choices";
97+
var MAIN_ID = "main-content";
9798

9899
function getThemesElement() {
99100
return document.getElementById(THEMES_ELEMENT_ID);
@@ -362,7 +363,7 @@ function hideThemeButtonState() {
362363
}
363364

364365
var toggleAllDocsId = "toggle-all-docs";
365-
var main = document.getElementById("main");
366+
var main = document.getElementById(MAIN_ID);
366367
var savedHash = "";
367368

368369
function handleHashes(ev) {
@@ -787,7 +788,7 @@ function hideThemeButtonState() {
787788
} else {
788789
addClass(innerToggle, "will-expand");
789790
onEachLazy(document.getElementsByClassName("rustdoc-toggle"), function(e) {
790-
if (e.parentNode.id !== "main" ||
791+
if (e.parentNode.id !== MAIN_ID ||
791792
(!hasClass(e, "implementors-toggle") &&
792793
!hasClass(e, "type-contents-toggle")))
793794
{

src/librustdoc/html/static/js/source-script.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,17 +113,17 @@ function createSourceSidebar() {
113113
if (!window.rootPath.endsWith("/")) {
114114
window.rootPath += "/";
115115
}
116-
var main = document.querySelector("nav.sidebar");
116+
var container = document.querySelector("nav.sidebar");
117117

118118
var sidebarToggle = createSidebarToggle();
119-
main.insertBefore(sidebarToggle, main.firstChild);
119+
container.insertBefore(sidebarToggle, container.firstChild);
120120

121121
var sidebar = document.createElement("div");
122122
sidebar.id = "source-sidebar";
123123
if (getCurrentValue("rustdoc-source-sidebar-show") !== "true") {
124-
main.classList.remove("expanded");
124+
container.classList.remove("expanded");
125125
} else {
126-
main.classList.add("expanded");
126+
container.classList.add("expanded");
127127
}
128128

129129
var currentFile = getCurrentFilePath();
@@ -139,7 +139,7 @@ function createSourceSidebar() {
139139
currentFile, hasFoundFile);
140140
});
141141

142-
main.insertBefore(sidebar, document.querySelector(".sidebar-logo").nextSibling);
142+
container.insertBefore(sidebar, document.querySelector(".sidebar-logo").nextSibling);
143143
// Focus on the current file in the source files sidebar.
144144
var selected_elem = sidebar.getElementsByClassName("selected")[0];
145145
if (typeof selected_elem !== "undefined") {

src/librustdoc/html/templates/page.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
</form> {#- -#}
126126
</nav> {#- -#}
127127
</div> {#- -#}
128-
<section id="main" class="content">{{- content | safe -}}</section> {#- -#}
128+
<section id="main-content" class="content">{{- content | safe -}}</section> {#- -#}
129129
<section id="search" class="content hidden"></section> {#- -#}
130130
</div> {#- -#}
131131
</main> {#- -#}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// This test ensures that the docblock elements have the appropriate left margin.
22
goto: file://|DOC_PATH|/test_docs/fn.foo.html
33
// The top docblock elements shouldn't have left margin...
4-
assert-css: ("#main .docblock.item-decl", {"margin-left": "0px"})
4+
assert-css: ("#main-content .docblock.item-decl", {"margin-left": "0px"})
55
// ... but all the others should!
6-
assert-css: ("#main .docblock:not(.item-decl)", {"margin-left": "24px"})
6+
assert-css: ("#main-content .docblock:not(.item-decl)", {"margin-left": "24px"})

src/test/rustdoc-gui/escape-key.goml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ goto: file://|DOC_PATH|/test_docs/index.html
33
write: (".search-input", "test")
44
wait-for: "#search > h1" // The search element is empty before the first search
55
assert-attribute: ("#search", {"class": "content"})
6-
assert-attribute: ("#main", {"class": "content hidden"})
6+
assert-attribute: ("#main-content", {"class": "content hidden"})
77
press-key: "Escape"
88
assert-attribute: ("#search", {"class": "content hidden"})
9-
assert-attribute: ("#main", {"class": "content"})
9+
assert-attribute: ("#main-content", {"class": "content"})
1010

1111
// Check that focusing the search input brings back the search results
1212
focus: ".search-input"
1313
assert-attribute: ("#search", {"class": "content"})
14-
assert-attribute: ("#main", {"class": "content hidden"})
14+
assert-attribute: ("#main-content", {"class": "content hidden"})
1515

1616
// Now let's check that when the help popup is displayed and we press Escape, it doesn't
1717
// hide the search results too.
@@ -20,7 +20,7 @@ assert-attribute: ("#help", {"class": ""})
2020
press-key: "Escape"
2121
assert-attribute: ("#help", {"class": "hidden"})
2222
assert-attribute: ("#search", {"class": "content"})
23-
assert-attribute: ("#main", {"class": "content hidden"})
23+
assert-attribute: ("#main-content", {"class": "content hidden"})
2424

2525
// Check that Escape hides the search results when a search result is focused.
2626
focus: ".search-input"
@@ -31,4 +31,4 @@ assert: "#results a:focus"
3131
press-key: "Escape"
3232
assert-attribute: ("#help", {"class": "hidden"})
3333
assert-attribute: ("#search", {"class": "content hidden"})
34-
assert-attribute: ("#main", {"class": "content"})
34+
assert-attribute: ("#main-content", {"class": "content"})
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
// This test ensures that the impl blocks are open by default.
22
goto: file://|DOC_PATH|/test_docs/struct.Foo.html
3-
assert-attribute: ("#main > details.implementors-toggle", {"open": ""})
3+
assert-attribute: ("#main-content > details.implementors-toggle", {"open": ""})

0 commit comments

Comments
 (0)