function computePropertiesValue(element, computedStyle) {
  var elementStyle = element.style;
  var elementCSSText = elementStyle.cssText;
  var currentComputedStyleForUse = computedStyle;
  var currentComputedStyle = currentComputedStyleForUse;
  var inDisplayNone = currentComputedStyle.getPropertyValue('display') === 'none';

  if (inDisplayNone) {
    elementStyle.display = 'initial';
    elementStyle.cssText = elementCSSText;
  }

  var propertiesToBeHandled = {};
  ['top', 'left', 'bottom', 'right', 'width', 'height'].forEach(function (propertyName) {
    var computedValue = 0;

    if (inDisplayNone && (propertyName === 'width' || propertyName === 'height')) {
      elementStyle.display = 'initial';
      computedValue = getWidthHeight(element, propertyName, currentComputedStyleForUse);
      elementStyle.cssText = elementCSSText;
      propertiesToBeHandled[propertyName] = String(computedValue);
    } else {
      computedValue = currentComputedStyle[propertyName];

      if (!computedValue) {
        computedValue = element.style[propertyName];
      }

      if (computedValue === 'auto') {
        if (propertyName === 'width' || propertyName === 'height') {
          computedValue = getWidthHeight(element, propertyName, currentComputedStyle);
        } else {
          var checkProperty;

          switch (propertyName) {
            case 'top':
            case 'left':
              checkProperty = 1;
              break;

            case 'right':
            case 'bottom':
              checkProperty = 2;
              break;

            default:
              checkProperty = 0;
              break;
          }

          if (checkProperty) {
            var position = currentComputedStyle.position;

            if (position === 'fixed' || checkProperty === 1 && position === 'absolute') {
              if (inDisplayNone) {
                elementStyle.display = 'initial';
              }

              computedValue = "".concat(element.getBoundingClientRect()[propertyName], "px");
              elementStyle.cssText = elementCSSText;
            } else {
              computedValue = '0px';
            }
          }
        }
      }

      propertiesToBeHandled[propertyName] = computedValue ? String(computedValue) : '';
    }
  });
  return propertiesToBeHandled;
}
/**
 * Normalizes some CSS properties that have not had a set value.
 *
 * @example
 * [ 'top', 'left', 'bottom', 'right', 'width', 'height' ]
 */
Normalizes some CSS properties that have not had a set value.
Normalizes some CSS properties that have not had a set value .
function computePropertiesValue(element, computedStyle) {
  var elementStyle = element.style;
  var elementCSSText = elementStyle.cssText;
  var currentComputedStyleForUse = computedStyle;
  var currentComputedStyle = currentComputedStyleForUse;
  var inDisplayNone = currentComputedStyle.getPropertyValue('display') === 'none';
  if (inDisplayNone) {
    elementStyle.display = 'initial';
    elementStyle.cssText = elementCSSText;
  }
  var propertiesToBeHandled = {};
  ['top', 'left', 'bottom', 'right', 'width', 'height'].forEach(function (propertyName) {
    var computedValue = 0;
    if (inDisplayNone && (propertyName === 'width' || propertyName === 'height')) {
      elementStyle.display = 'initial';
      computedValue = getWidthHeight(element, propertyName, currentComputedStyleForUse);
      elementStyle.cssText = elementCSSText;
      propertiesToBeHandled[propertyName] = String(computedValue);
    } else {
      computedValue = currentComputedStyle[propertyName];
      if (!computedValue) {
        computedValue = element.style[propertyName];
      }
      if (computedValue === 'auto') {
        if (propertyName === 'width' || propertyName === 'height') {
          computedValue = getWidthHeight(element, propertyName, currentComputedStyle);
        } else {
          var checkProperty;
          switch (propertyName) {
            case 'top':
            case 'left':
              checkProperty = 1;
              break;
            case 'right':
            case 'bottom':
              checkProperty = 2;
              break;
            default:
              checkProperty = 0;
              break;
          }
          if (checkProperty) {
            var position = currentComputedStyle.position;
            if (position === 'fixed' || checkProperty === 1 && position === 'absolute') {
              if (inDisplayNone) {
                elementStyle.display = 'initial';
              }
              computedValue = "".concat(element.getBoundingClientRect()[propertyName], "px");
              elementStyle.cssText = elementCSSText;
            } else {
              computedValue = '0px';
            }
          }
        }
      }
      propertiesToBeHandled[propertyName] = computedValue ? String(computedValue) : '';
    }
  });
  return propertiesToBeHandled;
}
function computePropertiesValue ( element , computedStyle ) { var elementStyle = element . style ; var elementCSSText = elementStyle . cssText ; var currentComputedStyleForUse = computedStyle ; var currentComputedStyle = currentComputedStyleForUse ; var inDisplayNone = currentComputedStyle . getPropertyValue ( 'display' ) === 'none' ; if ( inDisplayNone ) { elementStyle . display = 'initial' ; elementStyle . cssText = elementCSSText ; } var propertiesToBeHandled = { } ; [ 'top' , 'left' , 'bottom' , 'right' , 'width' , 'height' ] . forEach ( function ( propertyName ) { var computedValue = 0 ; if ( inDisplayNone && ( propertyName === 'width' || propertyName === 'height' ) ) { elementStyle . display = 'initial' ; computedValue = getWidthHeight ( element , propertyName , currentComputedStyleForUse ) ; elementStyle . cssText = elementCSSText ; propertiesToBeHandled [ propertyName ] = String ( computedValue ) ; } else { computedValue = currentComputedStyle [ propertyName ] ; if ( ! computedValue ) { computedValue = element . style [ propertyName ] ; } if ( computedValue === 'auto' ) { if ( propertyName === 'width' || propertyName === 'height' ) { computedValue = getWidthHeight ( element , propertyName , currentComputedStyle ) ; } else { var checkProperty ; switch ( propertyName ) { case 'top' : case 'left' : checkProperty = 1 ; break ; case 'right' : case 'bottom' : checkProperty = 2 ; break ; default : checkProperty = 0 ; break ; } if ( checkProperty ) { var position = currentComputedStyle . position ; if ( position === 'fixed' || checkProperty === 1 && position === 'absolute' ) { if ( inDisplayNone ) { elementStyle . display = 'initial' ; } computedValue = "" . concat ( element . getBoundingClientRect ( ) [ propertyName ] , "px" ) ; elementStyle . cssText = elementCSSText ; } else { computedValue = '0px' ; } } } } propertiesToBeHandled [ propertyName ] = computedValue ? String ( computedValue ) : '' ; } } ) ; return propertiesToBeHandled ; }
Normalizes some CSS properties that have not had a set value.
Normalizes some CSS properties that have not had a set value .