about summary refs log tree commit diff
path: root/src/librustdoc/html/static/js/source-script.js
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-07-04 06:35:29 +0000
committerbors <bors@rust-lang.org>2022-07-04 06:35:29 +0000
commit9c9ae85a4773be3c1e33717e4fa9759b4ce020ef (patch)
tree8886c755c7b106b1fe4c1b566f5fb344a35e41a1 /src/librustdoc/html/static/js/source-script.js
parenta5c6a48aee84215a9200dfa1c4c6ad88f5721f56 (diff)
parentc41e2080de243ced3e02625a4f17af99c5e227a7 (diff)
downloadrust-9c9ae85a4773be3c1e33717e4fa9759b4ce020ef.tar.gz
rust-9c9ae85a4773be3c1e33717e4fa9759b4ce020ef.zip
Auto merge of #98874 - matthiaskrgr:rollup-0u4hm54, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #98501 (rustc_passes/src/entry.rs: De-duplicate more code with `fn throw_attr_err()`)
 - #98774 (rustdoc: make source sidebar toggle a real button)
 - #98806 (Fix long declaration trailing whitespace)
 - #98823 (Fix rust-call ICE in mir-inliner)
 - #98870 (Add regression test for #86784)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src/librustdoc/html/static/js/source-script.js')
-rw-r--r--src/librustdoc/html/static/js/source-script.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/librustdoc/html/static/js/source-script.js b/src/librustdoc/html/static/js/source-script.js
index 9173e93e7c8..45e70c9a7c7 100644
--- a/src/librustdoc/html/static/js/source-script.js
+++ b/src/librustdoc/html/static/js/source-script.js
@@ -57,7 +57,7 @@ function createDirEntry(elem, parent, fullPath, hasFoundFile) {
 }
 
 function toggleSidebar() {
-    const child = this.children[0];
+    const child = this.parentNode.children[0];
     if (child.innerText === ">") {
         if (window.innerWidth < 701) {
             // This is to keep the scroll position on mobile.
@@ -86,15 +86,15 @@ function toggleSidebar() {
 function createSidebarToggle() {
     const sidebarToggle = document.createElement("div");
     sidebarToggle.id = "sidebar-toggle";
-    sidebarToggle.onclick = toggleSidebar;
 
-    const inner = document.createElement("div");
+    const inner = document.createElement("button");
 
     if (getCurrentValue("source-sidebar-show") === "true") {
         inner.innerText = "<";
     } else {
         inner.innerText = ">";
     }
+    inner.onclick = toggleSidebar;
 
     sidebarToggle.appendChild(inner);
     return sidebarToggle;