mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 23:34:48 +00:00
Move some DOM generation into the HTML settings file directly
This commit is contained in:
parent
77972d2d01
commit
72496d88d3
@ -596,9 +596,19 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
|
||||
|buf: &mut Buffer| {
|
||||
write!(
|
||||
buf,
|
||||
"<link rel=\"stylesheet\" type=\"text/css\" \
|
||||
href=\"{root_path}settings{suffix}.css\">\
|
||||
<script defer src=\"{root_path}settings{suffix}.js\"></script>",
|
||||
"<div class=\"main-heading\">\
|
||||
<h1 class=\"fqn\">\
|
||||
<span class=\"in-band\">Rustdoc settings</span>\
|
||||
</h1>\
|
||||
<span class=\"out-of-band\">\
|
||||
<a id=\"back\" href=\"javascript:void(0)\" onclick=\"history.back();\">\
|
||||
Back\
|
||||
</a>\
|
||||
</span>\
|
||||
</div>\
|
||||
<link rel=\"stylesheet\" type=\"text/css\" \
|
||||
href=\"{root_path}settings{suffix}.css\">\
|
||||
<script defer src=\"{root_path}settings{suffix}.js\"></script>",
|
||||
root_path = page.static_root_path.unwrap_or(""),
|
||||
suffix = page.resource_suffix,
|
||||
)
|
||||
|
@ -206,22 +206,8 @@
|
||||
];
|
||||
|
||||
// Then we build the DOM.
|
||||
let innerHTML = "";
|
||||
let elementKind = "div";
|
||||
|
||||
if (isSettingsPage) {
|
||||
elementKind = "section";
|
||||
innerHTML = `<div class="main-heading">
|
||||
<h1 class="fqn">
|
||||
<span class="in-band">Rustdoc settings</span>
|
||||
</h1>
|
||||
<span class="out-of-band">
|
||||
<a id="back" href="javascript:void(0)" onclick="history.back();">Back</a>
|
||||
</span>
|
||||
</div>`;
|
||||
}
|
||||
innerHTML += `<div class="settings">${buildSettingsPageSections(settings)}</div>`;
|
||||
|
||||
const elementKind = isSettingsPage ? "section" : "div";
|
||||
const innerHTML = `<div class="settings">${buildSettingsPageSections(settings)}</div>`;
|
||||
const el = document.createElement(elementKind);
|
||||
el.id = "settings";
|
||||
el.innerHTML = innerHTML;
|
||||
|
Loading…
Reference in New Issue
Block a user