function getDimensions(
  scrollElement: ?Element,
  props: WindowScrollerProps,
): Dimensions {
  if (!scrollElement) {
    return {
      height: props.serverHeight,
      width: props.serverWidth,
    };
  } else if (isWindow(scrollElement)) {
    const {innerHeight, innerWidth} = window;
    return {
      height: typeof innerHeight === 'number' ? innerHeight : 0,
      width: typeof innerWidth === 'number' ? innerWidth : 0,
    };
  } else {
    return getBoundingBox(scrollElement);
  }
}
Gets the dimensions of the element, accounting for API differences between
`window` and other DOM elements.