   normalizeAuto = (v) ->
     if v?
       v || "off"
+    else "off"
 
   constructor: (options = {}) ->
     @_focusEventsDisabled = false

    selectionEnd: (v)-> @domElement.selectionEnd = v

  insertAtCursor: (insertValue) ->
    log insertAtCursor: {insertValue}
    # //IE support
    # if (document.selection) {
    #     @domElement.focus();
    #     sel = document.selection.createRange();
    #     sel.text = insertValue;
    # }
    # //MOZILLA and others
    if @domElement.selectionStart || @domElement.selectionStart == '0'
      {value, selectionStart, selectionEnd} = @domElement
      log insertAtCursor: {value, selectionStart, selectionEnd,insertValue}


    @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
        @domElement.style.height = '0'
        @domElement.scrollHeight
      else 0

  _safeToProcessFocusEvents: ->
    if @_focusEventsDisabled
