From 0edc9e8395e3178e93e058e642abb51193a6dde8 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sat, 10 Nov 2018 21:58:47 +0100 Subject: [PATCH] Small fixes on code blocks in rustdoc --- src/librustdoc/html/static/main.js | 8 ++++---- src/librustdoc/html/static/rustdoc.css | 5 +++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index 4425712eed7a1..55415e973c50a 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -2262,17 +2262,17 @@ 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); diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css index 8f679b4d22b25..374e11c29a517 100644 --- a/src/librustdoc/html/static/rustdoc.css +++ b/src/librustdoc/html/static/rustdoc.css @@ -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;