Skip to content

Commit

Permalink
Fix unsafe assignments to innerHTML
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterOfTheTiger committed Apr 23, 2018
1 parent eab9394 commit d9e203c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions js/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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", "");
};
};

0 comments on commit d9e203c

Please sign in to comment.