 # @const
 ###
 PREFIX = vars.read 'component/prefix'
+
+
+###*
+# Default styles to set when calculating component dimensions.
+#
+# @type Object<string, string>
+# @const
+###
+STYLE_DEFAULTS =
+  height: 'auto'
+  width: 'auto'
 
 
 ###*

  # @method getRenderedDimensions
  # @memberof stout-ui/component/ComponentView#
  ###
  getRenderedDimensions: (target, resetStyles = []) ->
    promise = new Promise
    target ?= @root

    savedStyles = {}
    resetStyles = resetStyles.concat ['position', 'left']

    calcPositionOffScreen = =>
      style = @root.style

      # Save specified styles.
      for r in resetStyles
        savedStyles[r] = style[r]
        style[r] = setStyles[r] or STYLE_DEFAULTS[r] or ''

      # Calculate the dimensions.
      {width, height} = calculateDimensions()

      # If we still have a zero height or width, move out of it's parent and
      # recalculate.
      if width is 0 or height is 0

        # Move this component to directly under the body, so even if the parent
        # is hidden we can still calculate the size of this object.
        document.body.appendChild @root

        # Position off-screen.
        style.position = 'fixed'
        style.left = '-10000px'

        {width, height} = calculateDimensions()

        if parent and nextSibling
          parent.insertBefore @root, nextSibling
        else if parent
          parent.appendChild @root

      # Restore the original style and DOM position.
      for k, v of savedStyles
        style[k] = v

      Promise.fulfill promise, {width, height}

