Skip to content

Commit

Permalink
Change literal minus ‘−’ to HTML entity ‘−’
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
roryokane committed Apr 27, 2015
1 parent 02428df commit 72e8f7b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/librustdoc/html/render.rs
Expand Up @@ -1460,7 +1460,7 @@ impl<'a> fmt::Display for Item<'a> {
try!(write!(fmt, "<span class='out-of-band'>"));
try!(write!(fmt,
r##"<span id='render-detail'>
<a id="toggle-all-docs" href="#" title="collapse all docs">[]</a>
<a id="toggle-all-docs" href="#" title="collapse all docs">[&minus;]</a>
</span>"##));

// Write `src` tag
Expand Down
16 changes: 8 additions & 8 deletions src/librustdoc/html/static/main.js
Expand Up @@ -808,20 +808,20 @@

$("#toggle-all-docs").on("click", function() {
var toggle = $("#toggle-all-docs");
if (toggle.html() == "[]") {
toggle.html("[+]");
if (toggle.html() == "[&minus;]") {
toggle.html("[&plus;]");
toggle.attr("title", "expand all docs");
$(".docblock").hide();
$(".toggle-label").show();
$(".toggle-wrapper").addClass("collapsed");
$(".collapse-toggle").children(".inner").html("+");
$(".collapse-toggle").children(".inner").html("&plus;");
} else {
toggle.html("[]");
toggle.html("[&minus;]");
toggle.attr("title", "collapse all docs");
$(".docblock").show();
$(".toggle-label").hide();
$(".toggle-wrapper").removeClass("collapsed");
$(".collapse-toggle").children(".inner").html("");
$(".collapse-toggle").children(".inner").html("&minus;");
}
});

Expand All @@ -835,20 +835,20 @@
if (relatedDoc.is(":visible")) {
relatedDoc.slideUp({duration:'fast', easing:'linear'});
toggle.parent(".toggle-wrapper").addClass("collapsed");
toggle.children(".inner").html("+");
toggle.children(".inner").html("&plus;");
toggle.children(".toggle-label").fadeIn();
} else {
relatedDoc.slideDown({duration:'fast', easing:'linear'});
toggle.parent(".toggle-wrapper").removeClass("collapsed");
toggle.children(".inner").html("");
toggle.children(".inner").html("&minus;");
toggle.children(".toggle-label").hide();
}
}
});

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

$(".method").each(function() {
if ($(this).next().is(".docblock") ||
Expand Down

0 comments on commit 72e8f7b

Please sign in to comment.