From d9e203c4a10d543a548444041b03634fb5152a7e Mon Sep 17 00:00:00 2001 From: MasterOfTheTiger Date: Mon, 23 Apr 2018 08:55:02 -0700 Subject: [PATCH] Fix unsafe assignments to innerHTML --- js/popup.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/js/popup.js b/js/popup.js index cb65a38..dc737ae 100644 --- a/js/popup.js +++ b/js/popup.js @@ -13,10 +13,10 @@ function loadAPOD(url) { .then(response => response.json()) .then(result => { if("copyright" in result) { - document.getElementById('copyright').innerHTML = 'Image Credits: ' + result.copyright; + document.getElementById('copyright').textContent = 'Image Credits: ' + result.copyright; } else { - document.getElementById('copyright').innerHTML = 'Image Credits: ' + 'Public Domain'; + document.getElementById('copyright').textContent = 'Image Credits: ' + 'Public Domain'; } if(result.media_type == "video") { document.getElementById('apod_img_id').style.display = 'none'; @@ -47,8 +47,8 @@ function loadAPOD(url) { document.getElementById("facebookImage").href = fbText; //Add Title and explaination - document.getElementById('apod_explaination').innerHTML = result.explanation; - document.getElementById('apod_title').innerHTML = result.title; + document.getElementById('apod_explaination').textContent = result.explanation; + document.getElementById('apod_title').textContent = result.title; //Sets the date in the input box to the APOD date being viewed document.getElementById('date').value = result.date; //Hides next button when viewing today's picture @@ -156,4 +156,4 @@ document.getElementById("back").addEventListener("click", function(){ //Makes scrolling in popup hide sharing buttons (patch) window.onscroll = function () { shareOptions.className = shareOptions.className.replace(" w3-show", ""); -}; \ No newline at end of file +};