cq-prolyfill.js
function getComputedLength(value, element) {
	var length = value.match(LENGTH_REGEXP);
	if (!length) {
		return parseFloat(value);
	}
	value = parseFloat(length[1]);
	var unit = length[2].toLowerCase();
	if (FIXED_UNIT_MAP[unit]) {
		return value * FIXED_UNIT_MAP[unit];
	}
	if (unit === 'vw') {
		return value * window.innerWidth / 100;
	}
	if (unit === 'vh') {
		return value * window.innerHeight / 100;
	}
	if (unit === 'vmin') {
		return value * Math.min(window.innerWidth, window.innerHeight) / 100;
	}
	if (unit === 'vmax') {
		return value * Math.max(window.innerWidth, window.innerHeight) / 100;
	}
	// em units
	if (unit === 'rem') {
		element = documentElement;
	}
	if (unit === 'ex') {
		value /= 2;
	}
	return parseFloat(getComputedStyle(element).fontSize) * value;
}
function getComputedLength(value, element) {
	var length = value.match(LENGTH_REGEXP);
	if (!length) {
		return parseFloat(value);
	}
	value = parseFloat(length[1]);
	var unit = length[2].toLowerCase();
	if (FIXED_UNIT_MAP[unit]) {
		return value * FIXED_UNIT_MAP[unit];
	}
	if (unit === 'vw') {
		return value * window.innerWidth / 100;
	}
	if (unit === 'vh') {
		return value * window.innerHeight / 100;
	}
	if (unit === 'vmin') {
		return value * Math.min(window.innerWidth, window.innerHeight) / 100;
	}
	if (unit === 'vmax') {
		return value * Math.max(window.innerWidth, window.innerHeight) / 100;
	}
	// em units
	if (unit === 'rem') {
		element = documentElement;
	}
	if (unit === 'ex') {
		value /= 2;
	}
	return parseFloat(getComputedStyle(element).fontSize) * value;
}
function getComputedLength ( value , element ) { var length = value . match ( LENGTH_REGEXP ) ; if ( ! length ) { return parseFloat ( value ) ; } value = parseFloat ( length [ 1 ] ) ; var unit = length [ 2 ] . toLowerCase ( ) ; if ( FIXED_UNIT_MAP [ unit ] ) { return value * FIXED_UNIT_MAP [ unit ] ; } if ( unit === 'vw' ) { return value * window . innerWidth / 100 ; } if ( unit === 'vh' ) { return value * window . innerHeight / 100 ; } if ( unit === 'vmin' ) { return value * Math . min ( window . innerWidth , window . innerHeight ) / 100 ; } if ( unit === 'vmax' ) { return value * Math . max ( window . innerWidth , window . innerHeight ) / 100 ; } // em units if ( unit === 'rem' ) { element = documentElement ; } if ( unit === 'ex' ) { value /= 2 ; } return parseFloat ( getComputedStyle ( element ) . fontSize ) * value ; }
Get the computed length in pixel of a CSS length value

@param  {string}  value
@param  {Element} element
@return {number}
Get the computed length in pixel of a CSS length value