about summary refs log tree commit diff
path: root/src/librustdoc/html/static
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2020-06-27 17:56:13 +0200
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2020-07-02 13:19:04 +0200
commitcdabdfa104a3c0e7ba3ff2b37f967eb0e5000aae (patch)
treeeaaa7016014bc1b17829a488ceb1438ae7ae3955 /src/librustdoc/html/static
parentfc61cca41cb81af3c8167e8ceb596e2077d70310 (diff)
downloadrust-cdabdfa104a3c0e7ba3ff2b37f967eb0e5000aae.tar.gz
rust-cdabdfa104a3c0e7ba3ff2b37f967eb0e5000aae.zip
Simplify DOM by removing IDs for code tags
Diffstat (limited to 'src/librustdoc/html/static')
-rw-r--r--src/librustdoc/html/static/main.js21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index 8839d4fc4e5..69e2bacc218 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -306,14 +306,6 @@ function defocusSearchBar() {
     function expandSection(id) {
         var elem = document.getElementById(id);
         if (elem && isHidden(elem)) {
-            if (elem.tagName === "CODE" && elem.parentNode.tagName === "H4") {
-                // We are in a trait implementation, what we want is the parent.
-                elem = elem.parentNode;
-                if (elem.id !== null && elem.id.length > 0) {
-                    // Change the id to the parent which is "more clear" and better for users.
-                    window.location.hash = elem.id;
-                }
-            }
             var h3 = elem.parentNode.previousElementSibling;
             if (h3 && h3.tagName !== "H3") {
                 h3 = h3.previousElementSibling; // skip div.docblock
@@ -2561,6 +2553,13 @@ function defocusSearchBar() {
 
         onEachLazy(document.getElementsByClassName("docblock"), buildToggleWrapper);
         onEachLazy(document.getElementsByClassName("sub-variant"), buildToggleWrapper);
+        var pageId = getPageId();
+
+        autoCollapse(pageId, getCurrentValue("rustdoc-collapse") === "true");
+
+        if (pageId !== null) {
+            expandSection(pageId);
+        }
     }());
 
     function createToggleWrapper(tog) {
@@ -2696,12 +2695,6 @@ function defocusSearchBar() {
         hideSidebar();
     };
 
-    autoCollapse(pageId, getCurrentValue("rustdoc-collapse") === "true");
-
-    if (pageId !== null) {
-        expandSection(pageId);
-    }
-
     if (main) {
         onEachLazy(main.getElementsByClassName("loading-content"), function(e) {
             e.remove();