Skip to content

Commit

Permalink
Changed innerHTML to parsed DOM node
Browse files Browse the repository at this point in the history
  • Loading branch information
dougharris committed Jan 6, 2021
1 parent ac4e8d7 commit 0f7cd31
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions content-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,12 @@
messageHTML = "<p>You&rsquo;ve been redirected to the " +
"docs for <strong>" + version +
"</strong>.&nbsp;&nbsp;- Unified Docs Switcher</p>";
debugMsg(`going to display banner:\n${messageHTML}`);
let parsed = new DOMParser().parseFromString(messageHTML, 'text/html');
let messageP = parsed.querySelector('p');

messageDiv = document.createElement('div');
messageDiv.setAttribute('id', 'doc-switch-banner');
messageDiv.innerHTML = messageHTML;
messageDiv.appendChild(messageP);
messageDiv.addEventListener('click', () => { hideMsg(0); });
document.body.appendChild(messageDiv);

Expand Down

0 comments on commit 0f7cd31

Please sign in to comment.