/*----------------------------------------
* objectFitPolyfill 2.3.5
*
* Made by Constance Chen
* Released under the ISC license
*
* https://github.com/constancecchen/object-fit-polyfill
*--------------------------------------*/
(function() {
'use strict';
// if the page is being rendered on the server, don't continue
if (typeof window === 'undefined') return;
// Workaround for Edge 16-18, which only implemented object-fit for tags
var edgeMatch = window.navigator.userAgent.match(/Edge\/(\d{2})\./);
var edgeVersion = edgeMatch ? parseInt(edgeMatch[1], 10) : null;
var edgePartialSupport = edgeVersion
? edgeVersion >= 16 && edgeVersion <= 18
: false;
// If the browser does support object-fit, we don't need to continue
var hasSupport = 'objectFit' in document.documentElement.style !== false;
if (hasSupport && !edgePartialSupport) {
window.objectFitPolyfill = function() {
return false;
};
return;
}
/**
* Check the container's parent element to make sure it will
* correctly handle and clip absolutely positioned children
*
* @param {node} $container - parent element
*/
var checkParentContainer = function($container) {
var styles = window.getComputedStyle($container, null);
var position = styles.getPropertyValue('position');
var overflow = styles.getPropertyValue('overflow');
var display = styles.getPropertyValue('display');
if (!position || position === 'static') {
$container.style.position = 'relative';
}
if (overflow !== 'hidden') {
$container.style.overflow = 'hidden';
}
// Guesstimating that people want the parent to act like full width/height wrapper here.
// Mostly attempts to target