about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorUrgau <urgau@numericable.fr>2025-04-21 17:15:33 +0200
committerUrgau <urgau@numericable.fr>2025-05-16 11:08:15 +0200
commit72f915aaca3fa3018269de4e57cd1bddf4a17a86 (patch)
treecd4e2f0bc0de0404acddb1ccfecf839ce1273c7d /src
parent8fcff8c6457f16cb0a2760f0b6a846e42d08f0e1 (diff)
downloadrust-72f915aaca3fa3018269de4e57cd1bddf4a17a86.tar.gz
rust-72f915aaca3fa3018269de4e57cd1bddf4a17a86.zip
Fix flicker when page loads
Diffstat (limited to 'src')
-rw-r--r--src/doc/rustc/theme/pagetoc.css14
-rw-r--r--src/doc/rustc/theme/pagetoc.js20
2 files changed, 6 insertions, 28 deletions
diff --git a/src/doc/rustc/theme/pagetoc.css b/src/doc/rustc/theme/pagetoc.css
index f8f45960d94..26c7ae78e8a 100644
--- a/src/doc/rustc/theme/pagetoc.css
+++ b/src/doc/rustc/theme/pagetoc.css
@@ -19,12 +19,6 @@
 }
 
 @media only screen {
-    main {
-        display: -webkit-box;
-        display: -ms-flexbox;
-        display: flex;
-    }
-
     @media (max-width: 1179px) {
         .sidebar-hidden #sidetoc {
             display: none;
@@ -51,14 +45,8 @@
         }
     }
 
-    .content-wrap {
-        width: 100%;
-    }
-
     #sidetoc {
-        margin-top: 20px;
-        margin-left: 20px;
-        margin-right: auto;
+        margin-left: calc(100% + 20px);
     }
     #pagetoc {
         position: fixed;
diff --git a/src/doc/rustc/theme/pagetoc.js b/src/doc/rustc/theme/pagetoc.js
index 29c09903a37..f3549a6de5b 100644
--- a/src/doc/rustc/theme/pagetoc.js
+++ b/src/doc/rustc/theme/pagetoc.js
@@ -72,28 +72,18 @@ function updatePageToc(elem = undefined) {
 }
 
 if (document.getElementById("sidetoc") === null) {
-    // Element doesn't exist yet, let's create it
-    const main = document.querySelector('main');
-    const wrapper = document.createElement('div');
-    wrapper.className = "content-wrap";
-
-    // Move all children into the wrapper
-    while (main.firstChild) {
-      wrapper.appendChild(main.firstChild);
-    }
-
-    // Append the wrapper back to main
-    main.appendChild(wrapper);
+    // The sidetoc element doesn't exist yet, let's create it
 
     // Create the empty sidetoc and pagetoc elements
     const sidetoc = document.createElement("div");
     const pagetoc = document.createElement("div");
     sidetoc.id = "sidetoc";
     pagetoc.id = "pagetoc";
-
-    // And append them to the current DOM
     sidetoc.appendChild(pagetoc);
-    main.appendChild(sidetoc);
+    
+    // And append them to the current DOM
+    const main = document.querySelector('main');
+    main.insertBefore(sidetoc, main.firstChild);
 }
 
 if (document.getElementsByClassName("header").length <= 1) {