core/responsive-image.js
function setDivTag(image, img) {
  var setElemStyle = DOM.setStyle(image.element);
  setElemStyle('backgroundImage', 'url(' + img.src + ')');

  if (image.preserveAspectRatio) {
    var w, h;

    if (image.knownDimensions) {
      w = image.knownDimensions[0];
      h = image.knownDimensions[1];
    } else {
      w = img.width;
      h = img.height;
    }

    setElemStyle('backgroundSize', 'cover');

    if (image.isFlexible) {
      setElemStyle('paddingBottom', ((h / w) * 100.0) + '%');
    } else {
      setElemStyle('width', w + 'px');
      setElemStyle('height', h + 'px');
    }
  }
}
function setDivTag(image, img) {
  var setElemStyle = DOM.setStyle(image.element);
  setElemStyle('backgroundImage', 'url(' + img.src + ')');

  if (image.preserveAspectRatio) {
    var w, h;

    if (image.knownDimensions) {
      w = image.knownDimensions[0];
      h = image.knownDimensions[1];
    } else {
      w = img.width;
      h = img.height;
    }

    setElemStyle('backgroundSize', 'cover');

    if (image.isFlexible) {
      setElemStyle('paddingBottom', ((h / w) * 100.0) + '%');
    } else {
      setElemStyle('width', w + 'px');
      setElemStyle('height', h + 'px');
    }
  }
}
function setDivTag ( image , img ) { var setElemStyle = DOM . setStyle ( image . element ) ; setElemStyle ( 'backgroundImage' , 'url(' + img . src + ')' ) ; if ( image . preserveAspectRatio ) { var w , h ; if ( image . knownDimensions ) { w = image . knownDimensions [ 0 ] ; h = image . knownDimensions [ 1 ] ; } else { w = img . width ; h = img . height ; } setElemStyle ( 'backgroundSize' , 'cover' ) ; if ( image . isFlexible ) { setElemStyle ( 'paddingBottom' , ( ( h / w ) * 100.0 ) + '%' ) ; } else { setElemStyle ( 'width' , w + 'px' ) ; setElemStyle ( 'height' , h + 'px' ) ; } } }
Set the image on the div element.
@param {Element} img Image element.
Set the image on the div element .