Skip to content

Commit

Permalink
fix(simple-service-worker): avoid HTML to appear as text (#234)
Browse files Browse the repository at this point in the history
* Fix #191

Fixes #191

* Update service-worker/simple-service-worker/app.js

Co-authored-by: Claas Augner <[email protected]>

---------

Co-authored-by: Claas Augner <[email protected]>
Co-authored-by: Brian Thomas Smith <[email protected]>
  • Loading branch information
3 people authored Mar 7, 2024
1 parent 50234c8 commit 9edd962
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion service-worker/simple-service-worker/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ const createGalleryFigure = async (galleryImage) => {
const myImage = document.createElement('img');
const myCaption = document.createElement('caption');
const myFigure = document.createElement('figure');
myCaption.textContent = `${galleryImage.name}: Taken by ${galleryImage.credit}`;
const myName = document.createElement('span');
myName.textContent = `${galleryImage.name}: `;
const myCredit = document.createElement('span');
myCredit.innerHTML = `Taken by ${galleryImage.credit}`;
myCaption.append(myName, myCredit);
myImage.src = window.URL.createObjectURL(imageBlob);
myImage.setAttribute('alt', galleryImage.alt);
myFigure.append(myImage, myCaption);
Expand Down

0 comments on commit 9edd962

Please sign in to comment.