about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRory O’Kane <rory@roryokane.com>2015-04-30 00:07:42 -0400
committerRory O’Kane <rory@roryokane.com>2015-04-30 00:07:42 -0400
commit2258aef74f4af9b7ac2087098494df77a6d5206c (patch)
tree56a26881a10e0735663186ea4973545dfc0219ee
parent5449f5d29e175230a1285ebe92394f50c76e1df6 (diff)
downloadrust-2258aef74f4af9b7ac2087098494df77a6d5206c.tar.gz
rust-2258aef74f4af9b7ac2087098494df77a6d5206c.zip
Fix doc [−] button bug by escaping differently
The cause of the problem is described here: https://github.com/rust-lang/rust/pull/24797#issuecomment-97049765 .

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.
-rw-r--r--src/librustdoc/html/render.rs2
-rw-r--r--src/librustdoc/html/static/main.js16
2 files changed, 9 insertions, 9 deletions
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index 9a26a925847..3d5e13f3270 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, "<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
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index c2a59278a86..cfa599041ee 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -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");
         }
     });
 
@@ -835,12 +835,12 @@
             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();
             }
         }
@@ -848,7 +848,7 @@
 
     $(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") ||