 
     @lastValue = @value
 
+  # Reference: https://stackoverflow.com/questions/454202/creating-a-textarea-with-auto-resize
   # returns childrenSize
   nonChildrenLayoutFirstPass: ->
     point @domElement.scrollWidth,
-      max @getPendingFontSize() * 1.4, if @value.length > 0 then @domElement.scrollHeight else 0
+      max @getPendingFontSize() * 1.4, if @value.length > 0
+        @domElement.style.height = '0'
+        @domElement.scrollHeight
+      else 0
 
   _safeToProcessFocusEvents: ->
     if @_focusEventsDisabled

  normalizeAuto = (v) ->
    if v?
      v || "off"

  constructor: (options = {}) ->
    @_focusEventsDisabled = false

  _unregister: ->
    @_canvasElementToFocusOnBlur?.focusCanvas()
    super

  delayedCheckIfValueChanged: ->
    timeout 0, => @checkIfValueChanged()

  checkIfValueChanged: ->
    if @lastValue != @value
