diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index b7b9bc5e1c07..43229420315a 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -1386,11 +1386,11 @@ impl Setting { description, ), Setting::Select { js_data_name, description, default_value, ref options } => format!( - "
\ + "
\
{}
\ -
", description, diff --git a/src/librustdoc/html/static/settings.css b/src/librustdoc/html/static/settings.css index 7c91f6b7d18e..4bacd7b245bb 100644 --- a/src/librustdoc/html/static/settings.css +++ b/src/librustdoc/html/static/settings.css @@ -31,9 +31,7 @@ .select-wrapper { float: right; - position: relative; - height: 27px; min-width: 25%; } @@ -42,23 +40,18 @@ appearance: none; -moz-appearance: none; -webkit-appearance: none; - background: none; border: 2px solid #ccc; padding-right: 28px; - width: 100%; } .select-wrapper img { pointer-events: none; - position: absolute; right: 0; bottom: 0; - background: #ccc; - height: 100%; width: 28px; padding: 0px 4px; diff --git a/src/librustdoc/html/static/settings.js b/src/librustdoc/html/static/settings.js index 67dc77330eec..00a01ac30bcf 100644 --- a/src/librustdoc/html/static/settings.js +++ b/src/librustdoc/html/static/settings.js @@ -1,21 +1,21 @@ // Local js definitions: -/* global getCurrentValue, updateLocalStorage */ +/* global getCurrentValue, updateLocalStorage, updateSystemTheme */ (function () { function changeSetting(settingName, value) { - updateLocalStorage('rustdoc-' + settingName, value); + updateLocalStorage("rustdoc-" + settingName, value); switch (settingName) { - case 'preferred-dark-theme': - case 'preferred-light-theme': - case 'use-system-theme': + case "preferred-dark-theme": + case "preferred-light-theme": + case "use-system-theme": updateSystemTheme(); break; } } function getSettingValue(settingName) { - return getCurrentValue('rustdoc-' + settingName); + return getCurrentValue("rustdoc-" + settingName); } function setEvents() { @@ -23,9 +23,10 @@ toggles: document.getElementsByClassName("slider"), selects: document.getElementsByClassName("select-wrapper") }; + var i; if (elems.toggles && elems.toggles.length > 0) { - for (var i = 0; i < elems.toggles.length; ++i) { + for (i = 0; i < elems.toggles.length; ++i) { var toggle = elems.toggles[i].previousElementSibling; var settingId = toggle.id; var settingValue = getSettingValue(settingId); @@ -39,8 +40,8 @@ } if (elems.selects && elems.selects.length > 0) { - for (var i = 0; i < elems.selects.length; ++i) { - var select = elems.selects[i].getElementsByTagName('select')[0]; + for (i = 0; i < elems.selects.length; ++i) { + var select = elems.selects[i].getElementsByTagName("select")[0]; var settingId = select.id; var settingValue = getSettingValue(settingId); if (settingValue !== null) { diff --git a/src/librustdoc/html/static/storage.js b/src/librustdoc/html/static/storage.js index 3ee693d6eaca..cf8b806501f3 100644 --- a/src/librustdoc/html/static/storage.js +++ b/src/librustdoc/html/static/storage.js @@ -110,8 +110,8 @@ function switchTheme(styleElem, mainStyleElem, newTheme, saveTheme) { }); if (found === true) { styleElem.href = newHref; - // If this new value comes from a system setting or from the previously saved theme, no - // need to save it. + // If this new value comes from a system setting or from the previously + // saved theme, no need to save it. if (saveTheme === true) { updateLocalStorage("rustdoc-theme", newTheme); } @@ -182,7 +182,10 @@ if (getCurrentValue("rustdoc-use-system-theme") !== "false" && window.matchMedia // call the function to initialize the theme at least once! updateSystemTheme(); } else { - switchTheme(currentTheme, mainTheme, - getCurrentValue("rustdoc-theme") || "light", - false); + switchTheme( + currentTheme, + mainTheme, + getCurrentValue("rustdoc-theme") || "light", + false + ); }