From 0a14ca4e16cec5dfac9208167b18539631488a10 Mon Sep 17 00:00:00 2001 From: Kevin Burke Date: Sat, 10 Dec 2016 20:50:47 -0800 Subject: [PATCH] godoc: don't select line numbers when highlighting source code CSS3 introduces the user-select property, which you can use to prevent snippets of text from being highlighted. This is also the technique used by Github to avoid highlighting line numbers when highlighting source code. For more information, see: https://developer.mozilla.org/en-US/docs/Web/CSS/user-select https://www.w3.org/TR/1999/WD-css3-userint-19990916#user-select Fixes golang/go#18279 Change-Id: Ia5eb68d5a042d6ee2a1c8e7bbad753a35de5c487 Reviewed-on: https://go-review.googlesource.com/34278 Reviewed-by: Brad Fitzpatrick Reviewed-by: Chris Broadfoot --- godoc/static/static.go | 6 ++++++ godoc/static/style.css | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/godoc/static/static.go b/godoc/static/static.go index a024ca09..74338bf7 100644 --- a/godoc/static/static.go +++ b/godoc/static/static.go @@ -2860,6 +2860,12 @@ pre .selection-comment { pre .ln { color: #999; } +.ln { + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} body { color: #222; } diff --git a/godoc/static/style.css b/godoc/static/style.css index b21bc24f..958f0146 100644 --- a/godoc/static/style.css +++ b/godoc/static/style.css @@ -30,6 +30,12 @@ pre .selection-comment { pre .ln { color: #999; } +.ln { + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} body { color: #222; }