Skip to content

Commit

Permalink
Fix doc [−] button bug by escaping differently
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
roryokane committed Apr 30, 2015
1 parent 5449f5d commit 2258aef
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
Original file line number Diff line number Diff line change
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">[&minus;]</a>
<a id="toggle-all-docs" href="#" title="collapse all docs">[&#x2212;]</a>
</span>"##));

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

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

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("&plus;");
toggle.children(".inner").html("+");
toggle.children(".toggle-label").fadeIn();
} else {
relatedDoc.slideDown({duration:'fast', easing:'linear'});
toggle.parent(".toggle-wrapper").removeClass("collapsed");
toggle.children(".inner").html("&minus;");
toggle.children(".inner").html("\u2212");
toggle.children(".toggle-label").hide();
}
}
});

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

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

0 comments on commit 2258aef

Please sign in to comment.