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
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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);