static/frontend/fetch: use innerText instead of innerHTML

Fixes b/285903147.

Change-Id: Ia3665cbd9590ad04cbd736d416c6542eac4c0cbf
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/501055
Run-TryBot: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
diff --git a/static/frontend/fetch/fetch.js b/static/frontend/fetch/fetch.js
index 556c4b0..962bd86 100644
--- a/static/frontend/fetch/fetch.js
+++ b/static/frontend/fetch/fetch.js
@@ -1,4 +1,4 @@
-var s=document.querySelector(".js-fetchButton");s&&s.addEventListener("click",e=>{e.preventDefault(),i()});async function i(){var a;let e=document.querySelector(".js-fetchMessage"),t=document.querySelector(".js-fetchMessageSecondary"),o=document.querySelector(".js-fetchButton"),n=document.querySelector(".js-fetchLoading");if(!(e&&t&&o&&n))return;e.textContent=`Fetching ${e.dataset.path}`,t.textContent="Feel free to navigate away and check back later, we\u2019ll keep working on it!",o.style.display="none",n.style.display="block";let c=await fetch(`/fetch${window.location.pathname}`,{method:"POST"});if(c.ok){window.location.reload();return}let r=await c.text();n.style.display="none",t.textContent="";let l=new DOMParser().parseFromString(r,"text/html");e.innerHTML=(a=l.documentElement.textContent)!=null?a:""}
+var s=document.querySelector(".js-fetchButton");s&&s.addEventListener("click",e=>{e.preventDefault(),i()});async function i(){var a;let e=document.querySelector(".js-fetchMessage"),t=document.querySelector(".js-fetchMessageSecondary"),o=document.querySelector(".js-fetchButton"),n=document.querySelector(".js-fetchLoading");if(!(e&&t&&o&&n))return;e.textContent=`Fetching ${e.dataset.path}`,t.textContent="Feel free to navigate away and check back later, we\u2019ll keep working on it!",o.style.display="none",n.style.display="block";let c=await fetch(`/fetch${window.location.pathname}`,{method:"POST"});if(c.ok){window.location.reload();return}let r=await c.text();n.style.display="none",t.textContent="";let l=new DOMParser().parseFromString(r,"text/html");e.innerText=(a=l.documentElement.textContent)!=null?a:""}
 /*!
  * @license
  * Copyright 2020 The Go Authors. All rights reserved.
diff --git a/static/frontend/fetch/fetch.js.map b/static/frontend/fetch/fetch.js.map
index 01cf795..597858b 100644
--- a/static/frontend/fetch/fetch.js.map
+++ b/static/frontend/fetch/fetch.js.map
@@ -1,7 +1,7 @@
 {
   "version": 3,
   "sources": ["fetch.ts"],
-  "sourcesContent": ["/*!\n * @license\n * Copyright 2020 The Go Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file.\n */\n\nconst fetchButton = document.querySelector('.js-fetchButton');\nif (fetchButton) {\n  fetchButton.addEventListener('click', e => {\n    e.preventDefault();\n    fetchPath();\n  });\n}\n\nasync function fetchPath() {\n  const fetchMessageEl = document.querySelector<HTMLHeadingElement>('.js-fetchMessage');\n  const fetchMessageSecondary = document.querySelector<HTMLParagraphElement>(\n    '.js-fetchMessageSecondary'\n  );\n  const fetchButton = document.querySelector<HTMLButtonElement>('.js-fetchButton');\n  const fetchLoading = document.querySelector<HTMLDivElement>('.js-fetchLoading');\n  if (!(fetchMessageEl && fetchMessageSecondary && fetchButton && fetchLoading)) {\n    return;\n  }\n  fetchMessageEl.textContent = `Fetching ${fetchMessageEl.dataset.path}`;\n  fetchMessageSecondary.textContent =\n    'Feel free to navigate away and check back later, we\u2019ll keep working on it!';\n  fetchButton.style.display = 'none';\n  fetchLoading.style.display = 'block';\n\n  const response = await fetch(`/fetch${window.location.pathname}`, { method: 'POST' });\n  if (response.ok) {\n    window.location.reload();\n    return;\n  }\n  const responseText = await response.text();\n  fetchLoading.style.display = 'none';\n  fetchMessageSecondary.textContent = '';\n  const responseTextParsedDOM = new DOMParser().parseFromString(responseText, 'text/html');\n  fetchMessageEl.innerHTML = responseTextParsedDOM.documentElement.textContent ?? '';\n}\n\nexport {};\n"],
+  "sourcesContent": ["/*!\n * @license\n * Copyright 2020 The Go Authors. All rights reserved.\n * Use of this source code is governed by a BSD-style\n * license that can be found in the LICENSE file.\n */\n\nconst fetchButton = document.querySelector('.js-fetchButton');\nif (fetchButton) {\n  fetchButton.addEventListener('click', e => {\n    e.preventDefault();\n    fetchPath();\n  });\n}\n\nasync function fetchPath() {\n  const fetchMessageEl = document.querySelector<HTMLHeadingElement>('.js-fetchMessage');\n  const fetchMessageSecondary = document.querySelector<HTMLParagraphElement>(\n    '.js-fetchMessageSecondary'\n  );\n  const fetchButton = document.querySelector<HTMLButtonElement>('.js-fetchButton');\n  const fetchLoading = document.querySelector<HTMLDivElement>('.js-fetchLoading');\n  if (!(fetchMessageEl && fetchMessageSecondary && fetchButton && fetchLoading)) {\n    return;\n  }\n  fetchMessageEl.textContent = `Fetching ${fetchMessageEl.dataset.path}`;\n  fetchMessageSecondary.textContent =\n    'Feel free to navigate away and check back later, we\u2019ll keep working on it!';\n  fetchButton.style.display = 'none';\n  fetchLoading.style.display = 'block';\n\n  const response = await fetch(`/fetch${window.location.pathname}`, { method: 'POST' });\n  if (response.ok) {\n    window.location.reload();\n    return;\n  }\n  const responseText = await response.text();\n  fetchLoading.style.display = 'none';\n  fetchMessageSecondary.textContent = '';\n  const responseTextParsedDOM = new DOMParser().parseFromString(responseText, 'text/html');\n  fetchMessageEl.innerText = responseTextParsedDOM.documentElement.textContent ?? '';\n}\n\nexport {};\n"],
   "mappings": "AAOA,IAAMA,EAAc,SAAS,cAAc,iBAAiB,EACxDA,GACFA,EAAY,iBAAiB,QAAS,GAAK,CACzC,EAAE,eAAe,EACjBC,EAAU,CACZ,CAAC,EAGH,eAAeA,GAAY,CAf3B,IAAAC,EAgBE,IAAMC,EAAiB,SAAS,cAAkC,kBAAkB,EAC9EC,EAAwB,SAAS,cACrC,2BACF,EACMJ,EAAc,SAAS,cAAiC,iBAAiB,EACzEK,EAAe,SAAS,cAA8B,kBAAkB,EAC9E,GAAI,EAAEF,GAAkBC,GAAyBJ,GAAeK,GAC9D,OAEFF,EAAe,YAAc,YAAYA,EAAe,QAAQ,OAChEC,EAAsB,YACpB,kFACFJ,EAAY,MAAM,QAAU,OAC5BK,EAAa,MAAM,QAAU,QAE7B,IAAMC,EAAW,MAAM,MAAM,SAAS,OAAO,SAAS,WAAY,CAAE,OAAQ,MAAO,CAAC,EACpF,GAAIA,EAAS,GAAI,CACf,OAAO,SAAS,OAAO,EACvB,OAEF,IAAMC,EAAe,MAAMD,EAAS,KAAK,EACzCD,EAAa,MAAM,QAAU,OAC7BD,EAAsB,YAAc,GACpC,IAAMI,EAAwB,IAAI,UAAU,EAAE,gBAAgBD,EAAc,WAAW,EACvFJ,EAAe,WAAYD,EAAAM,EAAsB,gBAAgB,cAAtC,KAAAN,EAAqD,EAClF",
   "names": ["fetchButton", "fetchPath", "_a", "fetchMessageEl", "fetchMessageSecondary", "fetchLoading", "response", "responseText", "responseTextParsedDOM"]
 }
diff --git a/static/frontend/fetch/fetch.ts b/static/frontend/fetch/fetch.ts
index d4100a6..3f4eb28 100644
--- a/static/frontend/fetch/fetch.ts
+++ b/static/frontend/fetch/fetch.ts
@@ -38,7 +38,7 @@
   fetchLoading.style.display = 'none';
   fetchMessageSecondary.textContent = '';
   const responseTextParsedDOM = new DOMParser().parseFromString(responseText, 'text/html');
-  fetchMessageEl.innerHTML = responseTextParsedDOM.documentElement.textContent ?? '';
+  fetchMessageEl.innerText = responseTextParsedDOM.documentElement.textContent ?? '';
 }
 
 export {};