core/responsive-image.js
function update(image) {
  if (image.lazyLoad) {
    return;
  }

  var rect = DOM.getRect(image.element);
  var foundBreakpoint;

  for (var i = 0; i < image.knownSizes.length; i++) {
    var s = image.knownSizes[i];

    if (rect.width <= s) {
      foundBreakpoint = s;
    } else {
      break;
    }
  }

  if (!foundBreakpoint) {
    foundBreakpoint = image.knownSizes[0];
  }

  if (foundBreakpoint !== image.currentBreakpoint || !image.hasRunOnce) {
    image.currentBreakpoint = foundBreakpoint;
    loadImageForBreakpoint(image, image.currentBreakpoint);
  }
}
function update(image) {
  if (image.lazyLoad) {
    return;
  }

  var rect = DOM.getRect(image.element);
  var foundBreakpoint;

  for (var i = 0; i < image.knownSizes.length; i++) {
    var s = image.knownSizes[i];

    if (rect.width <= s) {
      foundBreakpoint = s;
    } else {
      break;
    }
  }

  if (!foundBreakpoint) {
    foundBreakpoint = image.knownSizes[0];
  }

  if (foundBreakpoint !== image.currentBreakpoint || !image.hasRunOnce) {
    image.currentBreakpoint = foundBreakpoint;
    loadImageForBreakpoint(image, image.currentBreakpoint);
  }
}
function update ( image ) { if ( image . lazyLoad ) { return ; } var rect = DOM . getRect ( image . element ) ; var foundBreakpoint ; for ( var i = 0 ; i < image . knownSizes . length ; i ++ ) { var s = image . knownSizes [ i ] ; if ( rect . width <= s ) { foundBreakpoint = s ; } else { break ; } } if ( ! foundBreakpoint ) { foundBreakpoint = image . knownSizes [ 0 ] ; } if ( foundBreakpoint !== image . currentBreakpoint || ! image . hasRunOnce ) { image . currentBreakpoint = foundBreakpoint ; loadImageForBreakpoint ( image , image . currentBreakpoint ) ; } }
Detect the current breakpoint and update the element if necessary.
Detect the current breakpoint and update the element if necessary .