Skip to content
Snippets Groups Projects
Commit 15120436 authored by Stephen Mustgrave's avatar Stephen Mustgrave Committed by Sean B
Browse files

Issue #3285476 by vlad.dancer, smustgrave, seanB: ResizeObserver#observe()...

Issue #3285476 by vlad.dancer, smustgrave, seanB: ResizeObserver#observe() firing the callback immediately results in infinite loop for Chromium based browsers
parent 10204eda
Branches
Tags
No related merge requests found
......@@ -21,6 +21,7 @@
const availableWidth = Math.floor(image.parentNode.clientWidth);
const attrWidth = image.getAttribute('width');
const sources = image.getAttribute('data-srcset').split(',');
const currentSrc = image.getAttribute('src');
// If the selected image is already bigger than the available width,
// we do not update the image.
......@@ -39,6 +40,10 @@
}
}
if (responsiveImgPath === currentSrc) {
return;
}
// Update the "src" with the new image and also set the "width"
// attribute to easily check if we need a new image after resize.
image.setAttribute('src', responsiveImgPath);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment