Skip to content

Commit 509d8ad

Browse files
committed
rustdoc: remove redundant div.search-container
This wrapper DIV was originally added in 89e1fb3, when it allowed the search bar's size to be calculated without using `calc()`. This `width` hack can be removed using flexbox.
1 parent 126dbdc commit 509d8ad

File tree

3 files changed

+24
-31
lines changed

3 files changed

+24
-31
lines changed

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

+7-12
Original file line numberDiff line numberDiff line change
@@ -679,13 +679,16 @@ nav.sub {
679679
display: flex;
680680
align-items: center;
681681
}
682-
nav.sub form {
682+
.search-form {
683+
position: relative;
684+
display: flex;
685+
height: 34px;
683686
flex-grow: 1;
684687
}
685688
.source nav.sub {
686689
margin: 0 0 15px 0;
687690
}
688-
.source nav.sub form {
691+
.source .search-form {
689692
margin-left: 32px;
690693
}
691694

@@ -776,11 +779,6 @@ table,
776779
padding-right: 1.25rem;
777780
}
778781

779-
.search-container {
780-
position: relative;
781-
display: flex;
782-
height: 34px;
783-
}
784782
.search-results-title {
785783
margin-top: 0;
786784
white-space: nowrap;
@@ -856,15 +854,12 @@ so that we can apply CSS-filters to change the arrow color in themes */
856854
-webkit-appearance: textfield for search inputs. That
857855
causes rounded corners and no border on iOS Safari. */
858856
-webkit-appearance: none;
859-
/* Override Normalize.css: we have margins and do
860-
not want to overflow */
861-
box-sizing: border-box !important;
862857
outline: none;
863858
border: 1px solid var(--border-color);
864859
border-radius: 2px;
865860
padding: 8px;
866861
font-size: 1rem;
867-
width: 100%;
862+
flex-grow: 1;
868863
background-color: var(--button-background-color);
869864
color: var(--search-color);
870865
}
@@ -1951,7 +1946,7 @@ in storage.js
19511946
flex-direction: column;
19521947
}
19531948

1954-
nav.sub form {
1949+
.search-form {
19551950
align-self: stretch;
19561951
}
19571952

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -932,7 +932,7 @@ function loadCss(cssFileName) {
932932
* Hide all the popover menus.
933933
*/
934934
window.hidePopoverMenus = function() {
935-
onEachLazy(document.querySelectorAll(".search-container .popover"), elem => {
935+
onEachLazy(document.querySelectorAll(".search-form .popover"), elem => {
936936
elem.style.display = "none";
937937
});
938938
};

src/librustdoc/html/templates/page.html

+16-18
Original file line numberDiff line numberDiff line change
@@ -115,24 +115,22 @@ <h2></h2> {#- -#}
115115
</a> {#- -#}
116116
{%- endif -%}
117117
<form class="search-form"> {#- -#}
118-
<div class="search-container"> {#- -#}
119-
<span></span> {#- This empty span is a hacky fix for Safari - See #93184 -#}
120-
<input {# -#}
121-
class="search-input" {# -#}
122-
name="search" {# -#}
123-
autocomplete="off" {# -#}
124-
spellcheck="false" {# -#}
125-
placeholder="Click or press ‘S’ to search, ‘?’ for more options…" {# -#}
126-
type="search"> {#- -#}
127-
<div id="help-button" title="help" tabindex="-1"> {#- -#}
128-
<a href="{{page.root_path|safe}}help.html">?</a> {#- -#}
129-
</div> {#- -#}
130-
<div id="settings-menu" tabindex="-1"> {#- -#}
131-
<a href="{{page.root_path|safe}}settings.html" title="settings"> {#- -#}
132-
<img width="22" height="22" alt="Change settings" {# -#}
133-
src="{{static_root_path|safe}}wheel{{page.resource_suffix}}.svg"> {#- -#}
134-
</a> {#- -#}
135-
</div> {#- -#}
118+
<span></span> {#- This empty span is a hacky fix for Safari - See #93184 -#}
119+
<input {# -#}
120+
class="search-input" {# -#}
121+
name="search" {# -#}
122+
autocomplete="off" {# -#}
123+
spellcheck="false" {# -#}
124+
placeholder="Click or press ‘S’ to search, ‘?’ for more options…" {# -#}
125+
type="search"> {#- -#}
126+
<div id="help-button" title="help" tabindex="-1"> {#- -#}
127+
<a href="{{page.root_path|safe}}help.html">?</a> {#- -#}
128+
</div> {#- -#}
129+
<div id="settings-menu" tabindex="-1"> {#- -#}
130+
<a href="{{page.root_path|safe}}settings.html" title="settings"> {#- -#}
131+
<img width="22" height="22" alt="Change settings" {# -#}
132+
src="{{static_root_path|safe}}wheel{{page.resource_suffix}}.svg"> {#- -#}
133+
</a> {#- -#}
136134
</div> {#- -#}
137135
</form> {#- -#}
138136
</nav> {#- -#}

0 commit comments

Comments
 (0)