diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index 3f3f8201b00..1993f03efd1 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -1460,7 +1460,7 @@ impl<'a> fmt::Display for Item<'a> {
try!(write!(fmt, ""));
try!(write!(fmt,
r##"
- [-] [+]
+ [-]
"##));
// Write `src` tag
@@ -1473,8 +1473,8 @@ impl<'a> fmt::Display for Item<'a> {
match self.href(self.cx) {
Some(l) => {
try!(write!(fmt, "[src]",
- self.item.def_id.node, l));
+ href='{}' title='{}'>[src]",
+ self.item.def_id.node, l, "goto source code"));
}
None => {}
}
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index 0379c04be4d..9e00a64d3f5 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -806,18 +806,23 @@
window.location = $('.srclink').attr('href');
}
- $("#expand-all").on("click", function() {
- $(".docblock").show();
- $(".toggle-label").hide();
- $(".toggle-wrapper").removeClass("collapsed");
- $(".collapse-toggle").children(".inner").html("-");
- });
-
- $("#collapse-all").on("click", function() {
- $(".docblock").hide();
- $(".toggle-label").show();
- $(".toggle-wrapper").addClass("collapsed");
- $(".collapse-toggle").children(".inner").html("+");
+ $("#toggle-all-docs").on("click", function() {
+ var toggle = $("#toggle-all-docs");
+ if (toggle.html() == "[-]") {
+ toggle.html("[+]");
+ toggle.attr("title", "expand all docs");
+ $(".docblock").hide();
+ $(".toggle-label").show();
+ $(".toggle-wrapper").addClass("collapsed");
+ $(".collapse-toggle").children(".inner").html("+");
+ } else {
+ toggle.html("[-]");
+ toggle.attr("title", "collapse all docs");
+ $(".docblock").show();
+ $(".toggle-label").hide();
+ $(".toggle-wrapper").removeClass("collapsed");
+ $(".collapse-toggle").children(".inner").html("-");
+ }
});
$(document).on("click", ".collapse-toggle", function() {