Skip to content

Commit 2258aef

Browse files
committed
Fix doc [−] button bug by escaping differently
The cause of the problem is described here: rust-lang#24797 (comment) . I tested this new `main.js` by changing the `main.js` content of a rendered docs page to this new content. The [−] button worked again.
1 parent 5449f5d commit 2258aef

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/librustdoc/html/render.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1460,7 +1460,7 @@ impl<'a> fmt::Display for Item<'a> {
14601460
try!(write!(fmt, "<span class='out-of-band'>"));
14611461
try!(write!(fmt,
14621462
r##"<span id='render-detail'>
1463-
<a id="toggle-all-docs" href="#" title="collapse all docs">[&minus;]</a>
1463+
<a id="toggle-all-docs" href="#" title="collapse all docs">[&#x2212;]</a>
14641464
</span>"##));
14651465

14661466
// Write `src` tag

src/librustdoc/html/static/main.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -808,20 +808,20 @@
808808

809809
$("#toggle-all-docs").on("click", function() {
810810
var toggle = $("#toggle-all-docs");
811-
if (toggle.html() == "[&minus;]") {
812-
toggle.html("[&plus;]");
811+
if (toggle.html() == "[\u2212]") {
812+
toggle.html("[+]");
813813
toggle.attr("title", "expand all docs");
814814
$(".docblock").hide();
815815
$(".toggle-label").show();
816816
$(".toggle-wrapper").addClass("collapsed");
817-
$(".collapse-toggle").children(".inner").html("&plus;");
817+
$(".collapse-toggle").children(".inner").html("+");
818818
} else {
819-
toggle.html("[&minus;]");
819+
toggle.html("[\u2212]");
820820
toggle.attr("title", "collapse all docs");
821821
$(".docblock").show();
822822
$(".toggle-label").hide();
823823
$(".toggle-wrapper").removeClass("collapsed");
824-
$(".collapse-toggle").children(".inner").html("&minus;");
824+
$(".collapse-toggle").children(".inner").html("\u2212");
825825
}
826826
});
827827

@@ -835,20 +835,20 @@
835835
if (relatedDoc.is(":visible")) {
836836
relatedDoc.slideUp({duration:'fast', easing:'linear'});
837837
toggle.parent(".toggle-wrapper").addClass("collapsed");
838-
toggle.children(".inner").html("&plus;");
838+
toggle.children(".inner").html("+");
839839
toggle.children(".toggle-label").fadeIn();
840840
} else {
841841
relatedDoc.slideDown({duration:'fast', easing:'linear'});
842842
toggle.parent(".toggle-wrapper").removeClass("collapsed");
843-
toggle.children(".inner").html("&minus;");
843+
toggle.children(".inner").html("\u2212");
844844
toggle.children(".toggle-label").hide();
845845
}
846846
}
847847
});
848848

849849
$(function() {
850850
var toggle = $("<a/>", {'href': 'javascript:void(0)', 'class': 'collapse-toggle'})
851-
.html("[<span class='inner'>&minus;</span>]");
851+
.html("[<span class='inner'>\u2212</span>]");
852852

853853
$(".method").each(function() {
854854
if ($(this).next().is(".docblock") ||

0 commit comments

Comments
 (0)