]> git.lizzy.rs Git - rust.git/commitdiff
Small fixes on code blocks in rustdoc
authorGuillaume Gomez <guillaume1.gomez@gmail.com>
Sat, 10 Nov 2018 20:58:47 +0000 (21:58 +0100)
committerGuillaume Gomez <guillaume1.gomez@gmail.com>
Sat, 10 Nov 2018 20:58:47 +0000 (21:58 +0100)
src/librustdoc/html/static/main.js
src/librustdoc/html/static/rustdoc.css

index 4425712eed7a15aaf9fecc4ae761453769f31aac..55415e973c50ae0d0fc6775caac07debdb60d7bc 100644 (file)
     onEach(document.getElementsByClassName('rust-example-rendered'), function(e) {
         if (hasClass(e, 'compile_fail')) {
             e.addEventListener("mouseover", function(event) {
-                e.previousElementSibling.childNodes[0].style.color = '#f00';
+                this.parentElement.previousElementSibling.childNodes[0].style.color = '#f00';
             });
             e.addEventListener("mouseout", function(event) {
-                e.previousElementSibling.childNodes[0].style.color = '';
+                this.parentElement.previousElementSibling.childNodes[0].style.color = '';
             });
         } else if (hasClass(e, 'ignore')) {
             e.addEventListener("mouseover", function(event) {
-                e.previousElementSibling.childNodes[0].style.color = '#ff9200';
+                this.parentElement.previousElementSibling.childNodes[0].style.color = '#ff9200';
             });
             e.addEventListener("mouseout", function(event) {
-                e.previousElementSibling.childNodes[0].style.color = '';
+                this.parentElement.previousElementSibling.childNodes[0].style.color = '';
             });
         }
         lineNumbersFunc(e);
index 8f679b4d22b25d51f292e0b278f7ae7578e66e2f..374e11c29a5174e3b7f39192b96a5d386b9bc546 100644 (file)
@@ -284,6 +284,7 @@ nav.sub {
 
 body:not(.source) .example-wrap {
        display: inline-flex;
+       margin-bottom: 10px;
 }
 
 .example-wrap {
@@ -303,6 +304,10 @@ body:not(.source) .example-wrap > pre.rust {
        width: 100%;
 }
 
+body:not(.source) .example-wrap > pre {
+       margin: 0;
+}
+
 #search {
        margin-left: 230px;
        position: relative;