diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index 75e8eaf5753..dbcb2df3cf9 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -2069,16 +2069,20 @@
if (hasClass(this, "collapsed")) {
removeClass(this, "collapsed");
onEach(this.parentNode.getElementsByClassName("hidden"), function(x) {
- removeClass(x, "hidden");
- addClass(x, "x");
+ if (hasClass(x, "content") === false) {
+ removeClass(x, "hidden");
+ addClass(x, "x");
+ }
}, true);
this.innerHTML = "[" + labelForToggleButton(false) +
"] Hide default items"
} else {
addClass(this, "collapsed");
onEach(this.parentNode.getElementsByClassName("x"), function(x) {
- addClass(x, "hidden");
- removeClass(x, "x");
+ if (hasClass(x, "content") === false) {
+ addClass(x, "hidden");
+ removeClass(x, "x");
+ }
}, true);
this.innerHTML = "[" + labelForToggleButton(true) +
"] Show hidden default items";