Skip to content

Commit

Permalink
godoc/static: replace innerHTML with textContent
Browse files Browse the repository at this point in the history
Setting innerHTML is a more heavyweight operation that supports HTML.
What's being done here doesn't use HTML, so it's viable to use the more
lightweight textContent.

Change-Id: I46e9359ffe776001836cc09fea88b04364870db7
Reviewed-on: https://go-review.googlesource.com/c/tools/+/235577
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
  • Loading branch information
stamblerre committed May 28, 2020
1 parent af9456b commit 6be401e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions godoc/static/play.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function initPlayground(transport) {
var sk = e.shiftKey || localStorage.getItem('play-shiftKey') === 'true';
if (running) running.Kill();
output.style.display = 'block';
outpre.innerHTML = '';
outpre.textContent = '';
run1.style.display = 'none';
var options = { Race: sk };
running = transport.Run(text(code), PlaygroundOutput(outpre), options);
Expand All @@ -72,20 +72,20 @@ function initPlayground(transport) {
}

var run1 = document.createElement('button');
run1.innerHTML = 'Run';
run1.textContent = 'Run';
run1.className = 'run';
run1.addEventListener('click', onRun, false);
var run2 = document.createElement('button');
run2.className = 'run';
run2.innerHTML = 'Run';
run2.textContent = 'Run';
run2.addEventListener('click', onRun, false);
var kill = document.createElement('button');
kill.className = 'kill';
kill.innerHTML = 'Kill';
kill.textContent = 'Kill';
kill.addEventListener('click', onKill, false);
var close = document.createElement('button');
close.className = 'close';
close.innerHTML = 'Close';
close.textContent = 'Close';
close.addEventListener('click', onClose, false);

var button = document.createElement('div');
Expand Down
Loading

0 comments on commit 6be401e

Please sign in to comment.