src/utils/calculate-textarea-height.js
function calculateStyling(node) {
  const reactId = node.getAttribute('data-reactid');

  // calculate the computed style only once it's not in the cache
  if (!computedStyleCache[reactId]) {
    // In order to work with legacy browsers the second paramter for pseudoClass
    // has to be provided http://caniuse.com/#feat=getcomputedstyle
    const computedStyle = window.getComputedStyle(node, null);

    const boxSizing = (
      computedStyle.getPropertyValue('box-sizing') ||
      computedStyle.getPropertyValue('-moz-box-sizing') ||
      computedStyle.getPropertyValue('-webkit-box-sizing')
    );

    let verticalPaddingSize = 0;
    verticalPaddingSize = (
      parseFloat(computedStyle.getPropertyValue('padding-bottom')) +
      parseFloat(computedStyle.getPropertyValue('padding-top'))
    );

    let verticalBorderSize = 0;
    verticalBorderSize = (
      parseFloat(computedStyle.getPropertyValue('border-bottom-width')) +
      parseFloat(computedStyle.getPropertyValue('border-top-width'))
    );

    const sizingStyle = stylesToCopy
      .map(styleName => `${styleName}:${computedStyle.getPropertyValue(styleName)}  !important`)
      .join(';');

    // store the style, vertical padding size, vertical border size and
    // boxSizing inside the cache
    computedStyleCache[reactId] = {
      style: sizingStyle,
      verticalPaddingSize,
      verticalBorderSize,
      boxSizing,
    };
  }

  return computedStyleCache[reactId];
}
function calculateStyling(node) {
  const reactId = node.getAttribute('data-reactid');

  // calculate the computed style only once it's not in the cache
  if (!computedStyleCache[reactId]) {
    // In order to work with legacy browsers the second paramter for pseudoClass
    // has to be provided http://caniuse.com/#feat=getcomputedstyle
    const computedStyle = window.getComputedStyle(node, null);

    const boxSizing = (
      computedStyle.getPropertyValue('box-sizing') ||
      computedStyle.getPropertyValue('-moz-box-sizing') ||
      computedStyle.getPropertyValue('-webkit-box-sizing')
    );

    let verticalPaddingSize = 0;
    verticalPaddingSize = (
      parseFloat(computedStyle.getPropertyValue('padding-bottom')) +
      parseFloat(computedStyle.getPropertyValue('padding-top'))
    );

    let verticalBorderSize = 0;
    verticalBorderSize = (
      parseFloat(computedStyle.getPropertyValue('border-bottom-width')) +
      parseFloat(computedStyle.getPropertyValue('border-top-width'))
    );

    const sizingStyle = stylesToCopy
      .map(styleName => `${styleName}:${computedStyle.getPropertyValue(styleName)}  !important`)
      .join(';');

    // store the style, vertical padding size, vertical border size and
    // boxSizing inside the cache
    computedStyleCache[reactId] = {
      style: sizingStyle,
      verticalPaddingSize,
      verticalBorderSize,
      boxSizing,
    };
  }

  return computedStyleCache[reactId];
}
function calculateStyling ( node ) { const reactId = node . getAttribute ( 'data-reactid' ) ; // calculate the computed style only once it's not in the cache if ( ! computedStyleCache [ reactId ] ) { // In order to work with legacy browsers the second paramter for pseudoClass // has to be provided http://caniuse.com/#feat=getcomputedstyle const computedStyle = window . getComputedStyle ( node , null ) ; const boxSizing = ( computedStyle . getPropertyValue ( 'box-sizing' ) || computedStyle . getPropertyValue ( '-moz-box-sizing' ) || computedStyle . getPropertyValue ( '-webkit-box-sizing' ) ) ; let verticalPaddingSize = 0 ; verticalPaddingSize = ( parseFloat ( computedStyle . getPropertyValue ( 'padding-bottom' ) ) + parseFloat ( computedStyle . getPropertyValue ( 'padding-top' ) ) ) ; let verticalBorderSize = 0 ; verticalBorderSize = ( parseFloat ( computedStyle . getPropertyValue ( 'border-bottom-width' ) ) + parseFloat ( computedStyle . getPropertyValue ( 'border-top-width' ) ) ) ; const sizingStyle = stylesToCopy . map ( styleName => ` ${ styleName } ${ computedStyle . getPropertyValue ( styleName ) } ` ) . join ( ';' ) ; // store the style, vertical padding size, vertical border size and // boxSizing inside the cache computedStyleCache [ reactId ] = { style : sizingStyle , verticalPaddingSize , verticalBorderSize , boxSizing , } ; } return computedStyleCache [ reactId ] ; }
Returns an object containing the computed style and the combined vertical
padding size, combined vertical border size and box-sizing value.

This style is returned as string to be applied as attribute of an element.
Returns an object containing the computed style and the combined vertical padding size combined vertical border size and box - sizing value .