godoc: allow line numbers to be searched by ctrl+f

We used a css-pseudo class rule to move the line number inside
the pseudo element. The idea was to prevent line numbers from getting
selected while copying the code. But this was already implemented
with the "user-select: none" rule.

Since the spec was undefined on "user-select", we had to resort
to the pseudo-class, but now both FF and Chrome implement the correct
behavior.

Hence, moving the content to be inside the span, and removing the
pseudo-class rule.

Manually tested with Chrome 63 and Firefox 58 on Ubuntu.

Fixes golang/go#23724

Change-Id: I3e733db766b44875ba6bc3f6985cde2559d116e2
Reviewed-on: https://go-review.googlesource.com/93975
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
diff --git a/godoc/server.go b/godoc/server.go
index 3ebff5c..95b4775 100644
--- a/godoc/server.go
+++ b/godoc/server.go
@@ -644,7 +644,7 @@
 		// The first tab for the code snippet needs to start in column 9, so
 		// it indents a full 8 spaces, hence the two nbsp's. Otherwise the tab
 		// character only indents about two spaces.
-		fmt.Fprintf(saved, `<span id="L%d" class="ln" data-content="%6d">&nbsp;&nbsp;</span>`, n, n)
+		fmt.Fprintf(saved, `<span id="L%d" class="ln">%6d&nbsp;&nbsp;</span>`, n, n)
 		n++
 		saved.Write(line)
 		saved.WriteByte('\n')
diff --git a/godoc/static/static.go b/godoc/static/static.go
index dec963a..14739d8 100644
--- a/godoc/static/static.go
+++ b/godoc/static/static.go
@@ -2915,11 +2915,7 @@
 	-ms-user-select: none;
 	user-select: none;
 }
-.ln::before {
-	/* Inserting the line numbers as a ::before pseudo-element avoids making
-	 * them selectable; it's the trick Github uses as well. */
-	content: attr(data-content);
-}
+
 body {
 	color: #222;
 }
diff --git a/godoc/static/style.css b/godoc/static/style.css
index e4d1e4c..79989ee 100644
--- a/godoc/static/style.css
+++ b/godoc/static/style.css
@@ -37,11 +37,7 @@
 	-ms-user-select: none;
 	user-select: none;
 }
-.ln::before {
-	/* Inserting the line numbers as a ::before pseudo-element avoids making
-	 * them selectable; it's the trick Github uses as well. */
-	content: attr(data-content);
-}
+
 body {
 	color: #222;
 }