Skip to content

Commit 72e8f7b

Browse files
committed
Change literal minus ‘−’ to HTML entity ‘−’
So that if people accidentally delete the character, they won’t re-type it as a hyphen, which would cause bugs. I changed ‘+’ too, even though it won’t be re-typed incorrectly, so that it is easier to see when plus is used as a symbol for the button, and when it is used as an operator in code. It also makes it clearer that the use of an entity for minus is on purpose, so people won’t be tempted to replace the entity incorrectly with a hyphen character.
1 parent 02428df commit 72e8f7b

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">[]</a>
1463+
<a id="toggle-all-docs" href="#" title="collapse all docs">[&minus;]</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() == "[]") {
812-
toggle.html("[+]");
811+
if (toggle.html() == "[&minus;]") {
812+
toggle.html("[&plus;]");
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("+");
817+
$(".collapse-toggle").children(".inner").html("&plus;");
818818
} else {
819-
toggle.html("[]");
819+
toggle.html("[&minus;]");
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("");
824+
$(".collapse-toggle").children(".inner").html("&minus;");
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("+");
838+
toggle.children(".inner").html("&plus;");
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("");
843+
toggle.children(".inner").html("&minus;");
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'></span>]");
851+
.html("[<span class='inner'>&minus;</span>]");
852852

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

0 commit comments

Comments
 (0)