Skip to content

Commit

Permalink
Merge pull request #1981 from Tw1N88/fix
Browse files Browse the repository at this point in the history
- Fix unhandled rejection "EncodingError: The source image cannot be de… 
- Fix typo in attribute name
- Fix Cannot read properties of undefined (reading 'applyCurrentZoomPan')
  • Loading branch information
dimsemenov authored Oct 25, 2022
2 parents 1530ea7 + 5f0c642 commit 6ef9962
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/js/main-scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,10 @@ class MainScroll {
pswp.currSlide = this.itemHolders[1].slide;
pswp.contentLoader.updateLazy(positionDifference);

pswp.currSlide.applyCurrentZoomPan();
if (pswp.currSlide) {
pswp.currSlide.applyCurrentZoomPan();
}

pswp.dispatch('change');
}

Expand Down
2 changes: 1 addition & 1 deletion src/js/slide/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ class Content {
// purposefully using finally instead of then,
// as if srcset sizes changes dynamically - it may cause decode error
/** @type {HTMLImageElement} */
(this.element).decode().finally(() => {
(this.element).decode().catch(() => {}).finally(() => {
this.isDecoding = false;
this.appendImage();
});
Expand Down
2 changes: 1 addition & 1 deletion src/js/slide/placeholder.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Placeholder {
this.element.setAttribute('role', 'presentation');
}

this.element.setAttribute('aria-hiden', 'true');
this.element.setAttribute('aria-hidden', 'true');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/js/util/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export function removeTransitionStyle(el) {
*/
export function decodeImage(img) {
if ('decode' in img) {
return img.decode();
return img.decode().catch(() => {});
}

if (img.complete) {
Expand Down

0 comments on commit 6ef9962

Please sign in to comment.